8.2. 为断开连接的 OpenShift Container Platform 集群设置 Clair 的自我管理部署
使用以下步骤为断开连接的 OpenShift Container Platform 集群设置 Clair 的自我管理部署。
由于已知问题 PROJQUAY-6577,Red Hat Quay Operator 无法正确呈现自定义的 Clair config.yaml
文件。因此,以下步骤目前无法正常工作。
用户必须从头开始创建整个 Clair 配置,而不依赖于 Operator 来填充字段。要做到这一点,请按照 流程在断开连接的环境中对镜像进行 Clair 扫描 的说明。
使用以下步骤在 OpenShift Container Platform 上安装用于自我管理的 Clair 部署的 clairctl
CLI 工具。
流程
使用
podman cp
命令为自我管理的 Clair 部署安装clairctl
程序,例如:sudo podman cp clairv4:/usr/bin/clairctl ./clairctl
$ sudo podman cp clairv4:/usr/bin/clairctl ./clairctl
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置
clairctl
文件的权限,以便用户可以执行并运行它,例如:chmod u+x ./clairctl
$ chmod u+x ./clairctl
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
使用以下步骤为断开连接的 OpenShift Container Platform 集群部署自我管理的 Clair 容器。
先决条件
-
您已安装了
clairctl
命令行工具工具。
流程
为您的 Clair 配置文件创建一个文件夹,例如:
mkdir /etc/clairv4/config/
$ mkdir /etc/clairv4/config/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建 Clair 配置文件,并将
disable_updaters
参数设置为true
,例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用容器镜像启动 Clair,从您创建的文件中挂载到配置中:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2.3. 从连接的 Clair 实例导出更新程序捆绑包 复制链接链接已复制到粘贴板!
使用以下步骤从可访问互联网的 Clair 实例导出更新器捆绑包。
先决条件
-
您已安装了
clairctl
命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数被设置为true
。
流程
在可以访问互联网的 Clair 实例中,将
clairctl
CLI 工具与配置文件一起使用,以导出更新器捆绑包。例如:./clairctl --config ./config.yaml export-updaters updates.gz
$ ./clairctl --config ./config.yaml export-updaters updates.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
使用以下步骤在断开连接的 OpenShift Container Platform 集群中配置对 Clair 数据库的访问。
先决条件
-
您已安装了
clairctl
命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数被设置为true
。 - 您已从可访问互联网的 Clair 实例导出了更新器捆绑包。
流程
使用
oc
CLI 工具确定 Clair 数据库服务,例如:oc get svc -n quay-enterprise
$ oc get svc -n quay-enterprise
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE example-registry-clair-app ClusterIP 172.30.224.93 <none> 80/TCP,8089/TCP 4d21h example-registry-clair-postgres ClusterIP 172.30.246.88 <none> 5432/TCP 4d21h ...
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE example-registry-clair-app ClusterIP 172.30.224.93 <none> 80/TCP,8089/TCP 4d21h example-registry-clair-postgres ClusterIP 172.30.246.88 <none> 5432/TCP 4d21h ...
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 转发 Clair 数据库端口,使其可从本地机器访问。例如:
oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
$ oc port-forward -n quay-enterprise service/example-registry-clair-postgres 5432:5432
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新 Clair
config.yaml
文件,例如:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2.5. 将更新器捆绑包导入到断开连接的 OpenShift Container Platform 集群中 复制链接链接已复制到粘贴板!
使用以下步骤将 updaters 捆绑包导入到断开连接的 OpenShift Container Platform 集群中。
先决条件
-
您已安装了
clairctl
命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数被设置为true
。 - 您已从可访问互联网的 Clair 实例导出了更新器捆绑包。
- 您已将更新程序捆绑包传输到断开连接的环境中。
流程
使用
clairctl
CLI 工具将更新器捆绑包导入到 OpenShift Container Platform 部署的 Clair 数据库中:./clairctl --config ./clair-config.yaml import-updaters updates.gz
$ ./clairctl --config ./clair-config.yaml import-updaters updates.gz
Copy to Clipboard Copied! Toggle word wrap Toggle overflow