This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.3.11. 为断开连接的集群配置镜像流
在断开连接的环境中安装 OpenShift Container Platform 后,为 Cluster Samples Operator 和 must-gather
镜像流配置镜像流。
openshift
命名空间中大多数由 Cluster Samples Operator 管理的镜像流指向位于 registry.redhat.io 上红帽容器镜像仓库中的镜像。镜像功能不适用于这些镜像流。
jenkins
、jenkins-agent-maven
和 jenkins-agent-nodejs
镜像流的确来自安装有效负载,并由 Samples Operator 管理,因此这些镜像流不需要进一步的镜像操作。
将 Sample Operator 配置文件中的 samplesRegistry
字段设置为 registry.redhat.io 有很多冗余,因为它已经定向到 registry.redhat.io,只用于 Jenkins 镜像和镜像流。
cli
、installer
、must-gather
和 test
镜像流虽然属于安装有效负载的一部分,但不由 Cluster Samples Operator 管理。此流程中不涉及这些镜像流。
先决条件
-
使用具有
cluster-admin
角色的用户访问集群。 - 为您的镜像 registry 创建 pull secret。
流程
访问被镜像(mirror)的特定镜像流的镜像,例如:
oc get is <imagestream> -n openshift -o json | jq .spec.tags[].from.name | grep registry.redhat.io
$ oc get is <imagestream> -n openshift -o json | jq .spec.tags[].from.name | grep registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将 registry.redhat.io 中与您在受限网络环境中需要的任何镜像流关联的镜像,镜像 (mirror) 成一个定义的镜像 (mirror):
oc image mirror registry.redhat.io/rhscl/ruby-25-rhel7:latest ${MIRROR_ADDR}/rhscl/ruby-25-rhel7:latest
$ oc image mirror registry.redhat.io/rhscl/ruby-25-rhel7:latest ${MIRROR_ADDR}/rhscl/ruby-25-rhel7:latest
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建集群的镜像配置对象:
oc create configmap registry-config --from-file=${MIRROR_ADDR_HOSTNAME}..5000=$path/ca.crt -n openshift-config
$ oc create configmap registry-config --from-file=${MIRROR_ADDR_HOSTNAME}..5000=$path/ca.crt -n openshift-config
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 在集群的镜像配置对象中,为镜像添加所需的可信 CA:
oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge
$ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 更新 Cluster Samples Operator 配置对象中的
samplesRegistry
字段,使其包含镜像配置中定义的镜像位置的hostname
部分:oc edit configs.samples.operator.openshift.io -n openshift-cluster-samples-operator
$ oc edit configs.samples.operator.openshift.io -n openshift-cluster-samples-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意这是必要的,因为镜像流导入过程在此刻不使用镜像(mirro)或搜索机制。
将所有未镜像的镜像流添加到 Cluster Samples Operator 配置对象的
skippedImagestreams
字段。或者,如果您不想支持任何示例镜像流,在 Cluster Samples Operator 配置对象中将 Cluster Samples Operator 设置为Removed
。注意如果镜像流导入失败,Cluster Samples Operator 会发出警告,但 Cluster Samples Operator 会定期重试,或看起来并没有重试它们。
openshift
命名空间中的许多模板都引用镜像流。因此,使用Removed
清除镜像流和模板,将避免在因为缺少镜像流而导致镜像流和模板无法正常工作时使用它们。