28.13.3. 覆盖 Registry 配置
要创建新 registry pod 并自动替换旧的 pod:
创建名为 registryconfig.yaml 的新 registry 配置文件并添加以下信息:
version: 0.1 log: level: debug http: addr: :5000 storage: cache: blobdescriptor: inmemory delete: enabled: true azure: 1 accountname: azureblobacc accountkey: azureblobacckey container: azureblobname realm: core.windows.net 2 auth: openshift: realm: openshift middleware: registry: - name: openshift repository: - name: openshift options: acceptschema2: false pullthrough: true enforcequota: false projectcachettl: 1m blobrepositorycachettl: 10m storage: - name: openshift
创建新 registry 配置:
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
添加 secret:
$ oc set volume dc/docker-registry --add --type=secret \ --secret-name=registry-config -m /etc/docker/registry/
设置
REGISTRY_CONFIGURATION_PATH
环境变量:$ oc set env dc/docker-registry \ REGISTRY_CONFIGURATION_PATH=/etc/docker/registry/config.yaml
如果您已经创建了 registry 配置:
删除 secret:
$ oc delete secret registry-config
创建新 registry 配置:
$ oc create secret generic registry-config --from-file=config.yaml=registryconfig.yaml
启动新的推出部署来更新配置:
$ oc rollout latest docker-registry