Chapter 14. Creating stateless images with RHEL image builder
Use RHEL image builder to create stateless images. After building the image in the pxe-tar-xz format, you can use the resulting stateless PXE image output in PXE or UEFI HTTP network boot environments. For more information, see the README contained within the generated tarball file.
14.1. Building a PXE-bootable RHEL image with image builder CLI Copy linkLink copied to clipboard!
Use the RHEL image builder CLI and a customized blueprint to create a RHEL image for PXE deployments. The tarball includes kernel, initrd, and root file system components. Stateless PXE images are available for the 64-bit ARM and AMD and Intel 64-bit architectures and support some customizations.
Prerequisites
- An existing customized blueprint.
Procedure
Build the customized RHEL image:
$ image-builder build pxe-tar-xz --blueprint <blueprint-name>RHEL image builder creates the image in the current directory path:
<os>-pxe-tar-xz-<architecture>.tar.xzExtract the image components to your boot server. Locate the tarball file. If the tool created a directory, enter that directory to find the
.tar.xzfile. Then, extract it to your TFTP root:$ sudo tar -xJf <image-name>.tar.xz -C /var/lib/tftpboot/rhel-pxe/
14.2. Booting a stateless image in a PXE boot environment with an HTTP server Copy linkLink copied to clipboard!
Serve the rootfs.img image by using HTTP for faster and more reliable transfers than TFTP alone.
Prerequisites
-
An
<os>-pxe-tar-xz-<architecture>.tar.xzimage exists. -
The target system has enough memory to hold the kernel, initrd, and
rootfssimultaneously. 2GiB of capacity for small images, but it varies depending on the workload.
WarningInsufficient RAM can result in a kernel panic during the boot process.
Procedure
-
Prepare the TFTP server by placing the
vmlinuz,initrd.img, androotfs.imgfiles in the root directory of your TFTP server. -
Modify the
grub.cfgconfiguration, replacing theHTTP-SERVERplaceholder with the actual URL of your HTTP server. Serve the
rootfs.imgby using HTTP inside the directory containing therootfs.imgfile:$ python3 -m http.server 8000
14.3. Booting a stateless image in a PXE boot environment with a combined image Copy linkLink copied to clipboard!
Eliminate the need for a separate HTTP server by merging the root filesystem into the initial ramdisk.
Prerequisites
- A PXE stateless image exists.
-
The target system has enough memory to hold the kernel, initrd, and
rootfssimultaneously. 2GiB of capacity for small images, but it varies depending on the workload.
WarningInsufficient RAM can result in a kernel panic during the boot process.
Procedure
Create the rootfs CPIO archive:
$ echo rootfs.img | cpio -c --quiet -L -o > rootfs.cpioConcatenate the
initrd.imgandrootfs.cpioimages:$ cat initrd.img rootfs.cpio > combined.imgBoot the system by using the resulting
combined.imgfile as your initrd in your PXE configuration.NoteUsing a combined image significantly increases the initial network payload. Because the entire root filesystem is transferred during the PXE phase, ensure your network bandwidth can handle the increased traffic, especially when booting multiple systems simultaneously.