6.2. 使用非受管 Clair 数据库配置自定义 Clair 数据库
Red Hat Quay on OpenShift Container Platform 允许用户提供自己的 Clair 数据库。
使用以下步骤创建自定义 Clair 数据库。
注意
以下流程使用 SSL/TLS 认证设置 Clair。要查看不使用 SSL/TLS 认证设置 Clair 的类似流程,请参阅"使用受管 Clair 配置自定义 Clair 数据库"。
步骤
输入以下命令来创建包含
clair-config.yaml的 Quay 配置捆绑包 secret:oc create secret generic --from-file config.yaml=./config.yaml --from-file extra_ca_cert_rds-ca-2019-root.pem=./rds-ca-2019-root.pem --from-file clair-config.yaml=./clair-config.yaml --from-file ssl.cert=./ssl.cert --from-file ssl.key=./ssl.key config-bundle-secret
$ oc create secret generic --from-file config.yaml=./config.yaml --from-file extra_ca_cert_rds-ca-2019-root.pem=./rds-ca-2019-root.pem --from-file clair-config.yaml=./clair-config.yaml --from-file ssl.cert=./ssl.cert --from-file ssl.key=./ssl.key config-bundle-secretCopy to Clipboard Copied! Toggle word wrap Toggle overflow Clair
config.yaml文件示例Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意-
数据库证书挂载到
clair-config.yaml中的 Clair 应用程序 pod 上的/run/certs/rds-ca-2019-root.pem下。在配置clair-config.yaml时,必须指定它。 -
clair-config.yaml示例可在 OpenShift config 上的 Clair 中找到。
-
数据库证书挂载到
将
clair-config.yaml文件添加到捆绑包 secret 中,例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意更新后,提供的
clair-config.yaml文件会被挂载到 Clair pod 中。任何未提供的字段都使用 Clair 配置模块自动填充默认值。您可以点击 Build History 页面中的提交或运行
oc get pods -n <namespace> 来检查 Clair pod 的状态。例如:oc get pods -n <namespace>
$ oc get pods -n <namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
NAME READY STATUS RESTARTS AGE f192fe4a-c802-4275-bcce-d2031e635126-9l2b5-25lg2 1/1 Running 0 7s
NAME READY STATUS RESTARTS AGE f192fe4a-c802-4275-bcce-d2031e635126-9l2b5-25lg2 1/1 Running 0 7sCopy to Clipboard Copied! Toggle word wrap Toggle overflow