8.2. 为断开连接的 OpenShift Container Platform 集群设置自助管理的 Clair 部署
使用以下步骤为断开连接的 OpenShift Container Platform 集群设置 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 ./clairctlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 设置
clairctl文件的权限,以便可由用户执行并运行,例如:chmod u+x ./clairctl
$ chmod u+x ./clairctlCopy 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 实例中,将
clairctlCLI 工具与您的配置文件一起使用,以导出更新程序捆绑包。例如:./clairctl --config ./config.yaml export-updaters updates.gz
$ ./clairctl --config ./config.yaml export-updaters updates.gzCopy to Clipboard Copied! Toggle word wrap Toggle overflow
使用以下步骤配置对断开连接的 OpenShift Container Platform 集群中的 Clair 数据库的访问。
先决条件
-
您已安装了
clairctl命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml文件中,disable_updaters和airgap参数设置为true。 - 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。
流程
使用
ocCLI 工具确定您的 Clair 数据库服务,例如:oc get svc -n quay-enterprise
$ oc get svc -n quay-enterpriseCopy 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:5432Copy 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 集群中 复制链接链接已复制到粘贴板!
使用以下步骤将更新程序捆绑包导入到断开连接的 OpenShift Container Platform 集群中。
先决条件
-
您已安装了
clairctl命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml文件中,disable_updaters和airgap参数设置为true。 - 您已从可访问互联网的 Clair 实例导出了更新程序捆绑包。
- 您已将更新程序捆绑包传送到断开连接的环境中。
流程
使用
clairctlCLI 工具将更新程序捆绑包导入到 OpenShift Container Platform 部署的 Clair 数据库中:./clairctl --config ./clair-config.yaml import-updaters updates.gz
$ ./clairctl --config ./clair-config.yaml import-updaters updates.gzCopy to Clipboard Copied! Toggle word wrap Toggle overflow