3.2. 配置允许对容器镜像进行镜像的凭证
创建容器镜像 registry 凭证文件,以便您可以将红帽的镜像镜像到您的镜像。在安装主机上完成以下步骤。
先决条件
- 您已将镜像 registry 配置为在断开连接的环境中使用。
流程
-
从 Red Hat OpenShift Cluster Manager 下载
registry.redhat.iopull secret。 以 JSON 格式创建您的 pull secret 副本:
$ cat ./pull-secret | jq . > <path>/<pull_secret_file_in_json>指定将 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 生成 base64 编码的用户名和密码或令牌:
$ echo -n '<user_name>:<password>' | base64 -w0通过
<user_name>和<password>指定 registry 的用户名和密码。输出示例
BGVtbYk3ZHAtqXs=编辑 JSON 文件并添加描述 registry 的部分:
"auths": { "<mirror_registry>": { "auth": "<credentials>", "email": "you@example.com" } },-
对于
<mirror_registry> 值,请指定 registry 域名,以及您的镜像 registry 用来提供内容的可选端口。例如:registry.example.com或registry.example.com:8443。 -
对于 &
lt;credentials> 值,请指定镜像 registry 的 base64 编码用户名和密码。
修改的 pull secret 示例
{ "auths": { "registry.example.com": { "auth": "BGVtbYk3ZHAtqXs=", "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" } } }-
对于