28.13.3. 覆盖 Registry 配置
要创建新 registry pod 并自动替换旧的 pod:
创建名为 registryconfig.yaml 的新 registry 配置文件并添加以下信息:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建新 registry 配置:
oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 添加 secret:
oc set volume dc/docker-registry --add --type=secret \ --secret-name=registry-config -m /etc/docker/registry/$ oc set volume dc/docker-registry --add --type=secret \ --secret-name=registry-config -m /etc/docker/registry/Copy to Clipboard Copied! Toggle word wrap Toggle overflow 设置
REGISTRY_CONFIGURATION_PATH环境变量:oc set env dc/docker-registry \ REGISTRY_CONFIGURATION_PATH=/etc/docker/registry/config.yaml$ oc set env dc/docker-registry \ REGISTRY_CONFIGURATION_PATH=/etc/docker/registry/config.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 如果您已经创建了 registry 配置:
删除 secret:
oc delete secret registry-config
$ oc delete secret registry-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow 创建新 registry 配置:
oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 启动新的推出部署来更新配置:
oc rollout latest docker-registry
$ oc rollout latest docker-registryCopy to Clipboard Copied! Toggle word wrap Toggle overflow