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.2.5. 使用带有备用或经过镜像的 registry 的 Samples Operator 镜像流
OpenShift 命名空间中大多数由 Samples Operator 管理的镜像流指向位于 registry.redhat.io 上红帽 registry 中的镜像。
jenkins、jenkins-agent-maven 和 jenkins-agent-nodejs 镜像流来自安装有效负载,并由 Samples Operator 管理。
将 Sample Operator 配置文件中的 samplesRegistry 字段设置为 registry.redhat.io 是多余的,因为它已将除 Jenkins 镜像和镜像流以外的所有内容都定向到 registry.redhat.io。它还会破坏 Jenkins 镜像流的安装有效负载。
Samples Operator 禁止将以下 registry 用于 Jenkins 镜像流:
cli、installer、must-gather 和 test 镜像流虽然属于安装有效负载的一部分,但不由 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.ioCopy to Clipboard Copied! Toggle word wrap Toggle overflow 来自 registry.redhat.io 的被镜像(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:latestCopy to Clipboard Copied! Toggle word wrap Toggle overflow 在集群的镜像配置对象中,为镜像添加所需的可信 CA:
oc create configmap registry-config --from-file=${MIRROR_ADDR_HOSTNAME}..5000=$path/ca.crt -n openshift-config oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=merge$ oc create configmap registry-config --from-file=${MIRROR_ADDR_HOSTNAME}..5000=$path/ca.crt -n openshift-config $ oc patch image.config.openshift.io/cluster --patch '{"spec":{"additionalTrustedCA":{"name":"registry-config"}}}' --type=mergeCopy to Clipboard Copied! Toggle word wrap Toggle overflow 更新 Samples Operator 配置对象中的
samplesRegistry字段,使其包含镜像配置中定义的镜像位置的hostname部分:oc get configs.samples.operator.openshift.io -n openshift-cluster-samples-operator
$ oc get configs.samples.operator.openshift.io -n openshift-cluster-samples-operatorCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意这是必要的,因为镜像流导入过程在此刻不使用镜像(mirro)或搜索机制。
将所有未镜像的镜像流添加到 Samples Operator 配置对象的
skippedImagestreams字段。或者,如果您不想支持任何示例镜像流,请在 Samples Operator 配置对象中将 Samples Operator 设置为Removed。注意镜像流导入失败两小时后,任何没有跳过的未镜像的镜像流,或者如果 Samples Operator 没有更改为
Removed,都会导致 Samples Operator 报告Degraded状态。OpenShift 命名空间中的多个模板都引用镜像流。因此,使用
Removed清除镜像流和模板,将避免在因为缺少镜像流而导致镜像流和模板无法正常工作时使用它们。