1.18.2.5. 为已镜像的 registry 配置证书

如果您使用安全的外部容器 registry 来存储已镜像的 OpenShift Container Platform 发行镜像,OpenShift Update Service 需要访问此 registry 来构建升级图。完成以下步骤以配置您的 CA 证书以用于 OpenShift Update Service Pod:

  1. 查找位于 image.config.openshift.io 的 OpenShift Container Platform 外部 registry API。这是存储外部 registry CA 证书的位置。

    如需更多信息,请参阅 OpenShift Container Platform 文档中的配置额外的信任存储以访问镜像 registry

  2. openshift-config 命名空间中创建 ConfigMap。
  3. 在密钥 updateservice-registry 中添加您的 CA 证书。OpenShift Update Service 使用此设置来定位您的证书:

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: trusted-ca
    data:
      updateservice-registry: |
        -----BEGIN CERTIFICATE-----
        ...
        -----END CERTIFICATE-----
  4. 编辑 image.config.openshift.io API 中的 cluster 资源,将 additionalTrustedCA 字段设置为您创建的 ConfigMap 的名称。

    oc patch image.config.openshift.io cluster -p '{"spec":{"additionalTrustedCA":{"name":"trusted-ca"}}}' --type merge

    trusted-ca 替换为新 ConfigMap 的路径。

OpenShift Update Service Operator 会监视 image.config.openshift.io API 和您在 openshift-config 命名空间中创建的 ConfigMap 以获取更改,然后在 CA 证书已更改时重启部署。