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.4.4. 为裸机和其他手动安装配置 registry 存储
作为集群管理员,在安装后需要配置 registry 来使用存储。
先决条件
- 集群管理员权限。
- 使用手动置备的 Red Hat Enterprise Linux CoreOS(RHCOS)节点(如裸机)的集群。
为集群置备的持久性存储,如 Red Hat OpenShift Container Storage。
重要当您只有一个副本时,OpenShift Container Platform 支持对镜像 registry 存储的
ReadWriteOnce访问。要部署支持高可用性的镜像 registry,需要两个或多个副本,ReadWriteMany访问。- 必须具有 100Gi 容量。
流程
要将 registry 配置为使用存储,请更改
configs。.imageregistry/cluster 资源中的 spec.storage.pvc注意使用共享存储时,请查看您的安全设置以防止外部访问。
验证您没有 registry pod:
oc get pod -n openshift-image-registry -l docker-registry=default
$ oc get pod -n openshift-image-registry -l docker-registry=defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
No resourses found in openshift-image-registry namespace
No resourses found in openshift-image-registry namespaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注意如果您的输出中有一个 registry pod,则不需要继续这个过程。
检查 registry 配置:
oc edit configs.imageregistry.operator.openshift.io
$ oc edit configs.imageregistry.operator.openshift.ioCopy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
storage: pvc: claim:storage: pvc: claim:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将
claim字段留空以允许自动创建image-registry-storagePVC。检查
clusteroperator状态:oc get clusteroperator image-registry
$ oc get clusteroperator image-registryCopy to Clipboard Copied! Toggle word wrap Toggle overflow 输出示例
NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE image-registry 4.7 True False False 6h50m
NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE MESSAGE image-registry 4.7 True False False 6h50mCopy to Clipboard Copied! Toggle word wrap Toggle overflow 确保 registry 设置为 managed,以启用镜像的构建和推送。
运行:
oc edit configs.imageregistry/cluster
$ oc edit configs.imageregistry/clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow 然后,更改行
managementState: Removed
managementState: RemovedCopy to Clipboard Copied! Toggle word wrap Toggle overflow 至
managementState: Managed
managementState: ManagedCopy to Clipboard Copied! Toggle word wrap Toggle overflow