Installing with image mode for RHEL
Embedding MicroShift in a bootc image
Abstract
Chapter 1. Understanding image mode for RHEL with MicroShift Copy linkLink copied to clipboard!
You can embed MicroShift into an operating system image using image mode for Red Hat Enterprise Linux (RHEL).
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 Technology Preview Features Support Scope.
1.1. About image mode for Red Hat Enterprise Linux (RHEL) Copy linkLink copied to clipboard!
Image mode for Red Hat Enterprise Linux (RHEL) is a Technology Preview deployment method that uses a container-native approach to build, deploy, and manage the operating system as a bootc image. By using bootc, you can build, deploy, and manage the operating system as if it is any other container.
- This container image uses standard OCI or Docker containers as a transport and delivery format for base operating system updates.
- A bootc image includes a Linux kernel that is used to start the operating system.
- By using bootc containers, developers, operations administrators, and solution providers can all use the same container-native tools and techniques.
Image mode splits the creation and installation of software changes into two steps: one on a build system and one on a running target system.
- In the build-system step, a Podman build inspects the RPM files available for installation, determines any dependencies, and creates an ordered list of chained steps to complete, with the end result being a new operating system available to install.
- In the running-target-system step, a bootc update downloads, unpacks, and makes the new operating system bootable alongside the currently running system. Local configuration changes are carried forward to the new operating system, but do not take effect until the system is rebooted and the new operating system image replaces the running image.
1.2. Additional resources Copy linkLink copied to clipboard!
Chapter 2. Installing a bootc image and publishing to a registry Copy linkLink copied to clipboard!
MicroShift is built and published as image mode containers. When installing a Red Hat Enterprise Linux (RHEL) bootable container image with MicroShift, use either a prebuilt bootable container image or build your own custom bootable container image.
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 Technology Preview Features Support Scope.
2.1. The image mode for RHEL with MicroShift workflow Copy linkLink copied to clipboard!
To use image mode for RHEL, ensure that the following resources are available:
- A RHEL 9.4 host with an active Red Hat subscription for building MicroShift bootc images.
- A remote registry for storing and accessing bootc images.
- You can use image mode for RHEL with a MicroShift cluster on AArch64 or x86_64 system architectures.
The workflow for using image mode with MicroShift includes the following steps:
- Find and use a prebuilt MicroShift container image to install Red Hat Enterprise Linux (RHEL).
- Build a custom MicroShift container image if the prebuilt MicroShift container image requires customization.
- Run the container image.
The rpm-ostree
file system is not supported in image mode. Do not use the rpm-ostree
file system to modify deployments that use image mode.
2.2. Get or build your bootc image Copy linkLink copied to clipboard!
Either get an existing bootc image or create one, then you can publish that image to a remote registry for use.
2.2.1. Getting the published bootc image for MicroShift Copy linkLink copied to clipboard!
You can use the MicroShift container images to install image mode for RHEL.
Prerequisites
- You have an x86_64 or AArch64 platform.
-
You have access to the
registry.redhat.io
registry.
Procedure
- Navigate to the Red Hat Ecosystem Catalog.
-
Search for the MicroShift container image by using the
microshift-bootc
keyword. - Open the container image page of the MicroShift container image.
-
Select the
Get this image
tab to view instructions for downloading the image. Get access to the latest image on x86_64 and AArch64 platforms by logging into the registry using the following command:
sudo podman login registry.redhat.io
$ sudo podman login registry.redhat.io
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Download the bootc image by running the following command:
podman pull registry.redhat.io/openshift4/microshift-bootc-rhel9:v4.18
$ podman pull registry.redhat.io/openshift4/microshift-bootc-rhel9:v4.18
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.2.2. Building the bootc image Copy linkLink copied to clipboard!
Build your Red Hat Enterprise Linux (RHEL) that contains MicroShift as a bootable container image by using a Containerfile.
Image mode for RHEL is Technology Preview. Using a bootc image in production environments is not supported.
Prerequisites
- A RHEL 9.4 host with an active Red Hat subscription for building MicroShift bootc images and running containers.
-
You logged into the RHEL 9.4 host by using the user credentials that have
sudo
permissions. -
The
rhocp
andfast-datapath
repositories are accessible in the host subscription. The repositories do not necessarily need to be enabled on the host. - You have a remote registry such as {quay} for storing and accessing bootc images.
Procedure
Create a Containerfile that includes the following instructions:
Example Containerfile for RHEL image mode
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantPodman uses the host subscription information and repositories inside the container when building the container image. If the
rhocp
andfast-datapath
repositories are not available on the host, the build fails.Set the
PULL_SECRET
environment variable:PULL_SECRET=~/.pull-secret.json
$ PULL_SECRET=~/.pull-secret.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the
USER_PASSWD
environment variable:USER_PASSWD=<redhat_user_password>
$ USER_PASSWD=<redhat_user_password>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <redhat_user_password> with your password.
Configure the
IMAGE_NAME
environment variable:IMAGE_NAME=microshift-4.18-bootc
$ IMAGE_NAME=microshift-4.18-bootc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a local bootc image by running the following image build command:
sudo podman build --authfile "${PULL_SECRET}" -t "${IMAGE_NAME}" \ --build-arg USER_PASSWD="${USER_PASSWD}" \ -f Containerfile
$ sudo podman build --authfile "${PULL_SECRET}" -t "${IMAGE_NAME}" \ --build-arg USER_PASSWD="${USER_PASSWD}" \ -f Containerfile
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantHow secrets are used during the image build:
-
The podman
--authfile
argument is required to pull the baserhel-bootc:9.4
image from theregistry.redhat.io
registry. -
The build
USER_PASSWD
argument is used to set a password for theredhat
user.
-
The podman
Verification
Verify that the local MicroShift bootc image was created by running the following command:
sudo podman images "${IMAGE_NAME}"
$ sudo podman images "${IMAGE_NAME}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
REPOSITORY TAG IMAGE ID CREATED SIZE localhost/microshift-4.18-bootc latest 193425283c00 2 minutes ago 2.31 GB
REPOSITORY TAG IMAGE ID CREATED SIZE localhost/microshift-4.18-bootc latest 193425283c00 2 minutes ago 2.31 GB
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3. Publishing the bootc image to the remote registry Copy linkLink copied to clipboard!
Publish your bootc image to the remote registry so that the image can be used for running the container on another host, or for when you want to install a new operating system with the bootc image layer.
Prerequisites
-
You are logged in to the RHEL 9.4 host where the image was built using the user credentials that have
sudo
permissions. - You have a remote registry such as {quay} for storing and accessing bootc images.
- You created the Containerfile and built the image.
Procedure
Set the
REGISTRY_URL
variable for the image by running the following command:REGISTRY_URL=<quay.io>
$ REGISTRY_URL=<quay.io>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <quay.io> with the URL for your image registry.
Log in to your remote registry by running the following command:
sudo podman login "${REGISTRY_URL}"
$ sudo podman login "${REGISTRY_URL}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
IMAGE_NAME
variable for the image by running the following command:IMAGE_NAME=<microshift-4.18-bootc>
$ IMAGE_NAME=<microshift-4.18-bootc>
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <microshift-4.18-bootc> with the name of the image you want to publish.
Set the
REGISTRY_IMG
variable for the image by running the following command:REGISTRY_IMG=<myorg/mypath>/"${IMAGE_NAME}"
$ REGISTRY_IMG=<myorg/mypath>/"${IMAGE_NAME}"
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <myorg/mypath> with your remote registry organization name and path.
Publish the image by running the following command:
sudo podman push localhost/"${IMAGE_NAME}" "${REGISTRY_URL}/${REGISTRY_IMG}"
$ sudo podman push localhost/"${IMAGE_NAME}" "${REGISTRY_URL}/${REGISTRY_IMG}"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- Run the container using the image you pushed to your registry as described in the "Running the MicroShift bootc container" section.
Chapter 3. Running the bootc image in a virtual machine Copy linkLink copied to clipboard!
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 Technology Preview Features Support Scope.
3.1. Creating the Kickstart file Copy linkLink copied to clipboard!
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_CONFIG
environment variable to reference the secret file in thekickstart.ks
file to authenticate private container registry access by running the following command:AUTH_CONFIG=~/.quay-auth.json
$ AUTH_CONFIG=~/.quay-auth.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
PULL_SECRET
environment variable to reference the secret files in thekickstart.ks
file to authenticate the OpenShift Container Platform registry access by running the following command:PULL_SECRET=~/.pull-secret.json
$ PULL_SECRET=~/.pull-secret.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the
IMAGE_REF
environment 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"
$ IMAGE_REF="quay.io/<myorg>/<mypath>/microshift-4.18-bootc"
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Replace <myorg/<mypath> with your remote registry organization name and path.
Create the
kickstart.ks
file to use during installation by running the following script:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Creating a virtual machine Copy linkLink copied to clipboard!
You can create a virtual machine by using the Red Hat Enterprise Linux (RHEL) boot ISO image.
Prerequisites
- You created the Kickstart file.
-
You installed the OpenShift CLI (
oc
). -
You have
redhat
credentials.
Procedure
- Download the Red Hat Enterprise Linux (RHEL) boot ISO image from the Download Red Hat Enterprise Linux.
-
Copy the downloaded file to the
/var/lib/libvirt/images
directory. Configure the VMNAME environment variable with your value by running the following command:
VMNAME=microshift-4.18-bootc
$ VMNAME=microshift-4.18-bootc
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the NETNAME environment variable with your value by running the following command:
NETNAME=default
$ NETNAME=default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a Red Hat Enterprise Linux (RHEL) virtual machine with 2 cores, 2GB of RAM and 20GB of storage by running the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
sudo virt-install
command uses the Kickstart file to pull a bootc image from the remote registry and install the RHEL operating system.-
Log in to the virtual machine by using your
redhat
credentials.
Verification
Verify that all of the MicroShift pods are running without error by entering the following command:
watch sudo oc get pods -A \ --kubeconfig /var/lib/microshift/resources/kubeadmin/kubeconfig
$ watch sudo oc get pods -A \ --kubeconfig /var/lib/microshift/resources/kubeadmin/kubeconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow