7.2.4. 配置 air-gapped OpenShift 集群中的 Clair 数据库访问
使用
kubectl
来确定 Clair 数据库服务:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 转发 Clair 数据库端口,使其可从本地机器访问,例如:
kubectl port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
$ kubectl port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新 Clair 配置文件,将多个
connstring
字段中的值替换为localhost
,例如:clair-config.yaml
... connstring: host=localhost port=5432 dbname=postgres user=postgres password=postgres sslmode=disable ...
... connstring: host=localhost port=5432 dbname=postgres user=postgres password=postgres sslmode=disable ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
注意
作为使用 kubectl port-forward
的替代选择,您可以使用 kubefwd
替代。使用此方法时,不需要修改 Clair 配置文件中的 connstring
字段,以使用 localhost
。