第 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
$ sudo openstack tripleo container image prepare default \ --output-env-file undercloud-container-image-prepare.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow 根据您的环境要求,修改
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!'ContainerImageRegistryCredentials: registry.redhat.io myser: 'p@55w0rd!'Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注意您无法将容器镜像推送到新 undercloud 上的 undercloud registry,因为
image-serveregistry 尚未安装。您必须将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
$ 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.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow undercloud-container-images.yaml文件是一个环境文件,包含服务参数到容器镜像的映射。例如,OpenStack Identity (keystone) 使用ContainerKeystoneImage参数来定义其容器镜像:ContainerKeystoneImage: undercloud.ctlplane.localdomain:8787/rhosp-rhel8/openstack-keystone:16.1.4-5
ContainerKeystoneImage: undercloud.ctlplane.localdomain:8787/rhosp-rhel8/openstack-keystone:16.1.4-5Copy to Clipboard Copied! Toggle word wrap Toggle overflow 请注意,容器镜像标签与
{version}-{release}格式匹配。-
将
undercloud-container-images.yaml文件包含在undercloud.conf文件的custom_env_files参数中。在运行 undercloud 安装时,undercloud 服务使用来自此文件的固定容器镜像映射。