5.2. 断开连接时为 Kubernetes Operator 准备基于代理的集群部署


您可以在断开连接的环境中将所需的 OpenShift Container Platform 容器镜像、多集群引擎 Operator 和 Local Storage Operator (LSO) 镜像 (LSO) 到断开连接的环境中的本地镜像 registry 中。确保您注意了镜像 registry 的本地 DNS 主机名和端口。

注意

要将 OpenShift Container Platform 镜像存储库镜像到您的镜像 registry,您可以使用 oc adm release imageoc mirror 命令。在此过程中,oc mirror 命令被用作示例。

流程

  1. 创建一个 <assets_directory> 文件夹,使其包含有效的 install-config.yamlagent-config.yaml 文件。此目录用于存储所有资产。
  2. 要镜像 OpenShift Container Platform 镜像存储库、多集群引擎和 LSO,请使用以下设置创建一个 ImageSetConfiguration.yaml 文件:

    示例 ImageSetConfiguration.yaml

      kind: ImageSetConfiguration
      apiVersion: mirror.openshift.io/v1alpha2
      archiveSize: 4 1
      storageConfig: 2
        imageURL: <your-local-registry-dns-name>:<your-local-registry-port>/mirror/oc-mirror-metadata 3
        skipTLS: true
      mirror:
        platform:
          architectures:
            - "amd64"
          channels:
            - name: stable-4.13 4
              type: ocp
        additionalImages:
          - name: registry.redhat.io/ubi9/ubi:latest
        operators:
          - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.13 5
            packages: 6
              - name: multicluster-engine 7
              - name: local-storage-operator 8

    1
    指定镜像集合中每个文件的最大大小(以 GiB 为单位)。
    2
    设置后端位置,以接收镜像设置元数据。此位置可以是 registry 或本地目录。必须指定 storageConfig 值。
    3
    设置存储后端的 registry URL。
    4
    设置包含您要安装的版本的 OpenShift Container Platform 镜像的频道。
    5
    设置包含您要安装的 OpenShift Container Platform 镜像的 Operator 目录。
    6
    仅指定要包含在镜像集中的特定 Operator 软件包和频道。删除此字段以检索目录中的所有软件包。
    7
    多集群引擎软件包和频道。
    8
    LSO 软件包和频道。
    注意

    在镜像内容时,oc mirror 命令需要此文件。

  3. 要镜像特定的 OpenShift Container Platform 镜像存储库、多集群引擎和 LSO,请运行以下命令:

    $ oc mirror --dest-skip-tls --config ocp-mce-imageset.yaml docker://<your-local-registry-dns-name>:<your-local-registry-port>
  4. 更新 install-config.yaml 文件中的 registry 和证书:

    示例 imageContentSources.yaml

      imageContentSources:
        - source: "quay.io/openshift-release-dev/ocp-release"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/openshift/release-images"
        - source: "quay.io/openshift-release-dev/ocp-v4.0-art-dev"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/openshift/release"
        - source: "registry.redhat.io/ubi9"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/ubi9"
        - source: "registry.redhat.io/multicluster-engine"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/multicluster-engine"
        - source: "registry.redhat.io/rhel8"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/rhel8"
        - source: "registry.redhat.io/redhat"
          mirrors:
            - "<your-local-registry-dns-name>:<your-local-registry-port>/redhat"

    另外,请确保您的证书存在于 install-config.yamladditionalTrustBundle 字段中。

    示例 install-config.yaml

    additionalTrustBundle: |
      -----BEGIN CERTIFICATE-----
      zzzzzzzzzzz
      -----END CERTIFICATE-------

    重要

    oc mirror 命令会创建一个名为 oc-mirror-workspace 的文件夹,其中包含几个输出。这包括 imageContentSourcePolicy.yaml 文件,用于标识 OpenShift Container Platform 和所选 Operator 所需的所有镜像。

  5. 运行以下命令来生成集群清单:

    $ openshift-install agent create cluster-manifests

    此命令更新集群 manifests 文件夹,使其包含包含您的镜像配置的 mirror 文件夹。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.