2.3. 配置允许对容器镜像进行镜像的凭证
创建容器镜像 registry 凭证文件,允许将红帽的镜像镜像到您的镜像环境中。
先决条件
- 配置了一个镜像(mirror) registry 在受限网络中使用。
流程
在安装主机上完成以下步骤:
-
从 Red Hat OpenShift Cluster Manager 站点的 Pull Secret 页面下载
registry.redhat.io
的 pull secret,将它保存为一个.json
文件。 为您的镜像 registry 生成 base64 编码的用户名和密码或令牌:
$ echo -n '<user_name>:<password>' | base64 -w0 1 BGVtbYk3ZHAtqXs=
- 1
- 通过
<user_name>
和<password>
指定 registry 的用户名和密码。
以 JSON 格式创建您的 pull secret 副本:
$ cat ./pull-secret.text | jq . > <path>/<pull-secret-file>1
- 1
- 指定到存储 pull secret 的文件夹的路径,以及您创建的 JSON 文件的名称。
该文件类似于以下示例:
{ "auths": { "cloud.openshift.com": { "auth": "b3BlbnNo...", "email": "you@example.com" }, "quay.io": { "auth": "b3BlbnNo...", "email": "you@example.com" }, "registry.connect.redhat.com": { "auth": "NTE3Njg5Nj...", "email": "you@example.com" }, "registry.redhat.io": { "auth": "NTE3Njg5Nj...", "email": "you@example.com" } } }
编辑新文件并添加描述 registry 的部分:
"auths": { "<mirror_registry>": { 1 "auth": "<credentials>", 2 "email": "you@example.com" },
该文件类似于以下示例:
{ "auths": { "<mirror_registry>": { "auth": "<credentials>", "email": "you@example.com" }, "cloud.openshift.com": { "auth": "b3BlbnNo...", "email": "you@example.com" }, "quay.io": { "auth": "b3BlbnNo...", "email": "you@example.com" }, "registry.connect.redhat.com": { "auth": "NTE3Njg5Nj...", "email": "you@example.com" }, "registry.redhat.io": { "auth": "NTE3Njg5Nj...", "email": "you@example.com" } } }