第 3 章 Running the bootc image in a virtual machine
Use the bootable container image as an installation source to set up a Red Hat Enterprise Linux (RHEL) virtual machine.
Image mode for RHEL is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see the following link:
3.1. Creating the Kickstart file 复制链接链接已复制到粘贴板!
You must create the Kickstart file to use during installation.
Prerequisites
- You have root-user access.
- You are logged in to the physical hypervisor host.
Procedure
Set the
AUTH_CONFIGenvironment variable to reference the secret file in thekickstart.ksfile to authenticate private container registry access by running the following command:$ AUTH_CONFIG=~/.quay-auth.jsonSet the
PULL_SECRETenvironment variable to reference the secret files in thekickstart.ksfile to authenticate the OpenShift Container Platform registry access by running the following command:$ PULL_SECRET=~/.pull-secret.jsonSet the
IMAGE_REFenvironment variable to reference the image mode for your container image to use during installation by running the following command:$ IMAGE_REF="quay.io/<myorg>/<mypath>/microshift-4.18-bootc"1 - 1
- Replace <myorg/<mypath> with your remote registry organization name and path.
Create the
kickstart.ksfile to use during installation by running the following script:$ 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