搜索

2.6. 将 hub 集群配置为使用断开连接的镜像 registry

download PDF

您可以将 hub 集群配置为使用断开连接的镜像 registry 作为断开连接的环境。

先决条件

  • 已安装 Red Hat Advanced Cluster Management (RHACM) 2.10 的断开连接的 hub 集群安装。
  • 您已在 HTTP 服务器中托管 rootfsiso 镜像。有关 Mirroring the OpenShift Container Platform image repository 的信息,请参阅附加资源部分
警告

如果为 HTTP 服务器启用 TLS,您必须确认 root 证书由客户端信任的颁发机构签名,并验证 OpenShift Container Platform hub 和受管集群和 HTTP 服务器之间的可信证书链。使用配置了不受信任的证书的服务器可防止将镜像下载到创建镜像中。不支持使用不受信任的 HTTPS 服务器。

流程

  1. 创建包含镜像 registry 配置的 ConfigMap

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: assisted-installer-mirror-config
      namespace: multicluster-engine 1
      labels:
        app: assisted-service
    data:
      ca-bundle.crt: | 2
        -----BEGIN CERTIFICATE-----
        <certificate_contents>
        -----END CERTIFICATE-----
    
      registries.conf: | 3
        unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
    
        [[registry]]
           prefix = ""
           location = "quay.io/example-repository" 4
           mirror-by-digest-only = true
    
           [[registry.mirror]]
           location = "mirror1.registry.corp.com:5000/example-repository" 5
    1
    ConfigMap 命名空间必须设置为 multicluster-engine
    2
    创建镜像 registry 时使用的镜像 registry 证书。
    3
    镜像 registry 的配置文件。镜像 registry 配置将镜像信息添加到发现镜像的 /etc/containers/registries.conf 文件中。当信息传递给安装程序时,镜像信息会存储在 install-config.yaml 文件的 imageContentSources 部分中。在 hub 集群上运行的 Assisted Service pod 从配置的镜像 registry 获取容器镜像。
    4
    镜像 registry 的 URL。在配置镜像 registry 时,您必须运行 oc adm release mirror 命令使用 imageContentSources 部分中的 URL。如需更多信息,请参阅 Mirroring the OpenShift Container Platform image repository 部分。
    5
    registries.conf 文件中定义的 registry 必须由存储库范围,而不是由 registry 范围。在本例中,quay.io/example-repositorymirror1.registry.corp.com:5000/example-repository 存储库都限定了 example-repository 存储库。

    这会更新 AgentServiceConfig 自定义资源中的 mirrorRegistryRef,如下所示:

    输出示例

    apiVersion: agent-install.openshift.io/v1beta1
    kind: AgentServiceConfig
    metadata:
      name: agent
      namespace: multicluster-engine 1
    spec:
      databaseStorage:
        volumeName: <db_pv_name>
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: <db_storage_size>
      filesystemStorage:
        volumeName: <fs_pv_name>
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: <fs_storage_size>
      mirrorRegistryRef:
        name: assisted-installer-mirror-config 2
      osImages:
        - openshiftVersion: <ocp_version>
          url: <iso_url> 3

    1
    AgentServiceConfig 命名空间设置为 multicluster-engine,以匹配 ConfigMap 命名空间
    2
    mirrorRegistryRef.name 设置为与相关 ConfigMap CR 中指定的定义匹配
    3
    设置在 httpd 服务器上托管的 ISO 的 URL
重要

集群安装过程中需要一个有效的 NTP 服务器。确保有合适的 NTP 服务器可用,并可通过断开连接的网络从安装的系统访问。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.