第 3 章 在虚拟机中运行 bootc 镜像
使用可引导容器镜像作为安装源来设置 Red Hat Enterprise Linux (RHEL)虚拟机。
重要
RHEL 的镜像模式只是一个技术预览功能。技术预览功能不受红帽产品服务等级协议(SLA)支持,且功能可能并不完整。红帽不推荐在生产环境中使用它们。这些技术预览功能可以使用户提早试用新的功能,并有机会在开发阶段提供反馈意见。
有关红帽技术预览功能支持范围的更多信息,请参阅技术预览功能支持范围。
3.1. 创建 Kickstart 文件 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您必须创建要在安装过程中使用的 Kickstart 文件。
先决条件
- 您有 root-user 访问权限。
- 您已登录到物理 hypervisor 主机。
流程
运行以下命令,设置
AUTH_CONFIG环境变量来引用kickstart.ks文件中的 secret 文件,以验证私有容器 registry 访问:$ AUTH_CONFIG=~/.quay-auth.json运行以下命令,设置
PULL_SECRET环境变量来引用kickstart.ks文件中的 secret 文件,以验证 OpenShift Container Platform registry 访问:$ PULL_SECRET=~/.pull-secret.json运行以下命令,将
IMAGE_REF环境变量设置为引用要在安装过程中使用的容器镜像的镜像模式:$ IMAGE_REF="quay.io/<myorg>/<mypath>/microshift-4.18-bootc"1 - 1
- 将 <myorg/<mypath > 替换为您的远程 registry 机构名称和路径。
通过运行以下脚本来创建在安装过程中使用的
kickstart.ks文件:$ cat > kickstart.ks <<EOFKS lang en_US.UTF-8 keyboard us timezone UTC text reboot # Partition the disk with hardware-specific boot and swap partitions, adding an # LVM volume that contains a 10GB+ system root. The remainder of the volume will # be used by the CSI driver for storing data. zerombr clearpart --all --initlabel # Create boot and swap partitions as required by the current hardware platform reqpart --add-boot # Add an LVM volume group and allocate a system root logical volume part pv.01 --grow volgroup rhel pv.01 logvol / --vgname=rhel --fstype=xfs --size=10240 --name=root # Lock root user account rootpw --lock # Configure network to use DHCP and activate on boot network --bootproto=dhcp --device=link --activate --onboot=on %pre-install --log=/dev/console --erroronfail # Create a 'bootc' image registry authentication file mkdir -p /etc/ostree cat > /etc/ostree/auth.json <<'EOF' $(cat "${AUTH_CONFIG}") EOF %end # Pull a 'bootc' image from a remote registry ostreecontainer --url "${IMAGE_REF}" %post --log=/dev/console --erroronfail # Create an OpenShift pull secret file cat > /etc/crio/openshift-pull-secret <<'EOF' $(cat "${PULL_SECRET}") EOF chmod 600 /etc/crio/openshift-pull-secret %end EOFKS