9.2. 为断开连接的 OpenShift Container Platform 集群设置 Clair 的自我管理部署
使用以下步骤为断开连接的 OpenShift Container Platform 集群设置 Clair 的自我管理部署。
使用以下步骤在 OpenShift Container Platform 上安装 clairctl
CLI 工具进行自我管理的 Clair 部署。
流程
使用
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
9.2.3. 从连接的 Clair 实例导出更新程序捆绑包 复制链接链接已复制到粘贴板!
使用以下步骤从可访问互联网的 Clair 实例导出 updaters 捆绑包。
先决条件
-
已安装
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 实例导出 updaters 捆绑包。
流程
使用
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
使用以下步骤将更新器捆绑包导入到断开连接的 OpenShift Container Platform 集群中。
先决条件
-
已安装
clairctl
命令行工具工具。 - 您已部署了 Clair。
-
在 Clair
config.yaml
文件中,disable_updaters
和airgap
参数被设置为true
。 - 您已从可访问互联网的 Clair 实例导出 updaters 捆绑包。
- 您已将更新器捆绑包传送到断开连接的环境中。
流程
使用
clairctl
CLI 工具将 updaters 捆绑包导入到 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