第 27 章 执行高级容器镜像管理
默认容器镜像配置适合大多数环境。在某些情况下,您的容器镜像配置可能需要一些自定义,如版本固定。
27.1. 为 undercloud 固定容器镜像
在某些情况下,您可能需要 undercloud 的一组特定容器镜像版本。在这种情况下,您必须将镜像固定到特定的版本。要固定镜像,您必须生成和修改容器配置文件,然后将 undercloud 角色数据和容器配置文件结合,以生成包含服务到容器镜像映射的环境文件。在 undercloud.conf
文件的 custom_env_files
参数中包含此环境文件。
步骤
-
以
stack
用户身份登录 undercloud 主机。 使用
--output-env-file
选项运行openstack tripleo container image prepare default
命令,生成包含默认镜像配置的文件:$ sudo openstack tripleo container image prepare default \ --output-env-file undercloud-container-image-prepare.yaml
根据您的环境要求,修改
undercloud-container-image-prepare.yaml
文件。-
移除
tag:
参数,以便 director 可以使用tag_from_label:
参数。director 使用此参数来标识每个容器镜像的最新版本,拉取每个镜像,并在 director 中的容器 registry 上标记每个镜像。 - 移除 undercloud 的 Ceph 标签。
-
确保
neutron_driver:
参数为空。不要将此参数设置为OVN
,因为 undercloud 不支持 OVN。 包含容器镜像 registry 凭据:
ContainerImageRegistryCredentials: registry.redhat.io: myser: 'p@55w0rd!'
注意您无法将容器镜像推送到新 undercloud 上的 undercloud registry,因为
image-serve
registry 尚未安装。您必须将push_destination
值设置为false
,或使用自定义值直接从源拉取镜像。如需更多信息,请参阅 容器镜像准备参数。
-
移除
生成新的容器镜像配置文件,该文件结合使用 undercloud 角色文件和自定义
undercloud-container-image-prepare.yaml
文件:$ sudo openstack tripleo container image prepare \ -r /usr/share/openstack-tripleo-heat-templates/roles_data_undercloud.yaml \ -e undercloud-container-image-prepare.yaml \ --output-env-file undercloud-container-images.yaml
undercloud-container-images.yaml
文件是一个环境文件,包含服务参数到容器镜像的映射。例如,OpenStack Identity (keystone) 使用ContainerKeystoneImage
参数来定义其容器镜像:ContainerKeystoneImage: undercloud.ctlplane.localdomain:8787/rhosp-rhel9/openstack-keystone:17.0
请注意,容器镜像标签与
{version}-{release}
格式匹配。-
将
undercloud-container-images.yaml
文件包含在undercloud.conf
文件的custom_env_files
参数中。在运行 undercloud 安装时,undercloud 服务使用来自此文件的固定容器镜像映射。