16.2. 在断开连接的环境中准备更新

当您的 Red Hat OpenShift Container Storage 环境没有直接连接到互联网时,需要一些额外的配置来为 Operator Lifecycle Manager (OLM) 提供默认 Operator Hub 和镜像 registry 的替代选择。

如需了解更多信息,请参阅 OpenShift Container Platform 文档: 更新 Operator 目录镜像

配置集群以进行断开连接的更新:

完成这些步骤后,请照常 继续更新

16.2.1. 添加镜像 registry 身份验证详情

先决条件

  • 验证现有的断开连接的集群是否使用 OpenShift Container Platform 4.3 或更高版本。
  • 验证 oc 客户端 版本是否为 4.4 或更高版本。
  • 使用镜像 registry 准备镜像主机。详情请参阅准备镜像主机

流程

  1. 使用 cluster-admin 角色登录 OpenShift Container Platform 集群。
  2. 查找 auth.json 文件。

    当您使用 podman 或 docker 登录 registry 时,会生成此文件。它位于以下位置之一:

    • ~/.docker/auth.json
    • /run/user/<UID>/containers/auth.json
    • /var/run/containers/<UID>/auth.json
  3. 获取您唯一的红帽 registry pull secret,并将其粘贴到 auth.json 文件中。它看起来类似于:

    {
        "auths": {
            "cloud.openshift.com": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "quay.io": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "registry.connect.redhat.com": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "registry.redhat.io": {
                "auth": "*****************",
                "email": "user@example.com"
            }
        }
      }
  4. 使用设置的适当详情导出环境变量。

    $ export AUTH_FILE="<location_of_auth.json>"
    $ export MIRROR_REGISTRY_DNS="<your_registry_url>:<port>"
  5. 使用 podman 登录镜像 registry,并将凭据存储在 ${AUTH_FILE} 中。

    $ podman login ${MIRROR_REGISTRY_DNS} --tls-verify=false --authfile ${AUTH_FILE}

    这会将镜像 registry 添加到 auth.json 文件中。

    {
        "auths": {
            "cloud.openshift.com": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "quay.io": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "registry.connect.redhat.com": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "registry.redhat.io": {
                "auth": "*****************",
                "email": "user@example.com"
            },
            "<mirror_registry>": {
                "auth": "*****************",
            }
        }
      }