2.6. 配置主机以进行镜像 registry 访问
要将 MicroShift 主机配置为使用镜像 registry,您必须通过创建一个配置文件来将红帽 registry 主机名映射到镜像(mirror)来提供 MicroShift 主机对 registry 的访问。
先决条件
- 您的镜像主机可访问互联网。
- 镜像主机可以访问镜像 registry。
- 您已配置了镜像 registry 以在受限网络中使用。
- 您下载了 pull secret,并将其修改为包含镜像存储库的身份验证。
流程
- 登录到您的 MicroShift 主机。
通过完成以下步骤,在访问镜像 registry 的任何主机上启用 SSL 证书信任:
-
将
rootCA.pem
文件从镜像 registry (如 <registry_path>/quay-rootCA
)复制到/etc/pki/ca-trust/source/anchors
目录中的 MicroShift 主机。 运行以下命令,在系统范围的信任存储配置中启用证书:
sudo update-ca-trust
$ sudo update-ca-trust
Copy to Clipboard Copied!
-
将
创建
/etc/containers/registries.conf.d/999-microshift-mirror.conf
配置文件,将红帽 registry 主机名映射到镜像 registry:镜像配置文件示例
[[registry]] prefix = "" location = "<registry_host>:<port>" mirror-by-digest-only = true insecure = false [[registry]] prefix = "" location = "quay.io" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false [[registry]] prefix = "" location = "registry.redhat.io" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false [[registry]] prefix = "" location = "registry.access.redhat.com" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false
[[registry]] prefix = "" location = "<registry_host>:<port>"
1 mirror-by-digest-only = true insecure = false [[registry]] prefix = "" location = "quay.io" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false [[registry]] prefix = "" location = "registry.redhat.io" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false [[registry]] prefix = "" location = "registry.access.redhat.com" mirror-by-digest-only = true [[registry.mirror]] location = "<registry_host>:<port>" insecure = false
Copy to Clipboard Copied! - 1
- 将
<registry_host>:<port
> 替换为镜像 registry 服务器的主机名和端口,例如 <microshift-quay:8443
>。
运行以下命令来启用 MicroShift 服务:
sudo systemctl enable microshift
$ sudo systemctl enable microshift
Copy to Clipboard Copied! 运行以下命令来重启主机:
sudo reboot
$ sudo reboot
Copy to Clipboard Copied!