4.3. 在断开连接的环境中安装
重要: 您需要将所需的镜像下载到镜像 registry 中,以便在断开连接的环境中安装 Operator。如果没有下载,您可能会在部署过程中收到 ImagePullBackOff
错误。
按照以下步骤在断开连接的环境中为 Kubernetes Operator 安装多集群引擎:
创建镜像 registry。如果您还没有镜像 registry,请按照 Red Hat OpenShift Container Platform 文档中的为断开连接的环境创建镜像的容器镜像的步骤来创建。
如果已有镜像 registry,可以配置和使用现有 registry。
注: 对于裸机,您需要在
install-config.yaml
文件中为断开连接的 registry 提供证书信息。要访问受保护的断开连接的 registry 中的镜像,您必须提供证书信息,以便 Kubernetes operator 的多集群引擎可以访问 registry。- 复制 registry 中的证书信息。
-
在编辑器中打开
install-config.yaml
文件。 -
找到
additionalTrustBundle: |
条目。 在
additionalTrustBundle
行后添加证书信息。内容应类似以下示例:additionalTrustBundle: | -----BEGIN CERTIFICATE----- certificate_content -----END CERTIFICATE----- sshKey: >-
重要: 如果需要以下监管策略,则需要额外的镜像 registry:
-
Container Security Operator 策略:镜像位于源
registry.redhat.io/quay
中。 -
Compliance operator 策略:镜像位于源
registry.redhat.io/compliance
中 Gatekeeper operator 策略:镜像位于源
registry.redhat.io/rhacm2
中参阅以下所有三个 operator 的镜像列表示例:
- mirrors: - <your_registry>/rhacm2 source: registry.redhat.io/rhacm2 - mirrors: - <your_registry>/quay source: registry.redhat.io/quay - mirrors: - <your_registry>/compliance source: registry.redhat.io/compliance
-
Container Security Operator 策略:镜像位于源
-
保存
install-config.yaml
文件。 创建一个包含
ImageContentSourcePolicy
的 YAML 文件,其名称为rhacm-policy.yaml
。注: 如果您在正在运行的集群中修改此操作,则会导致所有节点的滚动重启。apiVersion: operator.openshift.io/v1alpha1 kind: ImageContentSourcePolicy metadata: name: mce-repo spec: repositoryDigestMirrors: - mirrors: - mirror.registry.com:5000/multicluster-engine source: registry.redhat.io/multicluster-engine
输入以下命令应用 ImageContentSourcePolicy 文件:
oc apply -f mce-policy.yaml
启用断开连接的 Operator Lifecycle Manager Red Hat Operator 和 Community Operator。
Kubernetes operator 的多集群引擎包含在 Operator Lifecycle Manager Red Hat Operator 目录中。
- 为 Red Hat Operator 目录配置离线 Operator Lifecycle Manager。按照 Red Hat OpenShift Container Platform 文档中 受限网络部分中使用 Operator Lifecycle Manager 中的步骤操作。
- 现在,您已在断开连接的 Operator Lifecycle Manager 中已有镜像,从 Operator Lifecycle Manager 目录继续为 Kubernetes operator 安装多集群引擎。
如需了解所需步骤,请参阅在线安装。