4.2. 断开连接时为 Kubernetes Operator 准备基于代理的集群部署
您可以在断开连接的环境中将所需的 OpenShift Container Platform 容器镜像、多集群引擎 Operator 和 Local Storage Operator (LSO) 镜像 (LSO) 到断开连接的环境中的本地镜像 registry 中。确保您注意了镜像 registry 的本地 DNS 主机名和端口。
要将 OpenShift Container Platform 镜像存储库镜像到您的镜像 registry,您可以使用 oc adm release image
或 oc mirror
命令。在此过程中,oc mirror
命令被用作示例。
流程
-
创建一个
<assets_directory>
文件夹,使其包含有效的install-config.yaml
和agent-config.yaml
文件。此目录用于存储所有资产。 要镜像 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.12 4 type: ocp additionalImages: - name: registry.redhat.io/ubi8/ubi:latest operators: - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.12 5 packages: 6 - name: multicluster-engine 7 - name: local-storage-operator 8
- 1
- 指定镜像集合中每个文件的最大大小(以 GiB 为单位)。
- 2
- 设置后端位置,以接收镜像设置元数据。此位置可以是 registry 或本地目录。除非使用技术预览 OCI 功能,否则您必须指定
storageConfig
值。 - 3
- 设置存储后端的 registry URL。
- 4
- 设置包含您要安装的版本的 OpenShift Container Platform 镜像的频道。
- 5
- 设置包含您要安装的 OpenShift Container Platform 镜像的 Operator 目录。
- 6
- 仅指定要包含在镜像集中的特定 Operator 软件包和频道。删除此字段以检索目录中的所有软件包。
- 7
- 多集群引擎软件包和频道。
- 8
- LSO 软件包和频道。
注意在镜像内容时,
oc mirror
命令需要此文件。要镜像特定的 OpenShift Container Platform 镜像存储库、多集群引擎和 LSO,请运行以下命令:
$ oc mirror --dest-skip-tls --config ocp-mce-imageset.yaml docker://<your-local-registry-dns-name>:<your-local-registry-port>
更新
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/ubi8" mirrors: - "<your-local-registry-dns-name>:<your-local-registry-port>/ubi8" - 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.yaml
的additionalTrustBundle
字段中。示例
install-config.yaml
additionalTrustBundle: | -----BEGIN CERTIFICATE----- zzzzzzzzzzz -----END CERTIFICATE-------
重要oc mirror
命令会创建一个名为oc-mirror-workspace
的文件夹,其中包含几个输出。这包括imageContentSourcePolicy.yaml
文件,用于标识 OpenShift Container Platform 和所选 Operator 所需的所有镜像。运行以下命令来生成集群清单:
$ openshift-install agent create cluster-manifests
此命令更新集群 manifests 文件夹,使其包含包含您的镜像配置的
mirror
文件夹。