1.4. Configuring networking and storage to run MicroShift in a bootc container
1.4.1. Configuring the MicroShift bootc image for the CNI リンクのコピーリンクがクリップボードにコピーされました!
Configure a workaround for a kernel mismatch to enable the MicroShift OVN-Kubernetes (OVN-K) Container Network Interface (CNI).
The MicroShift OVN-K CNI requires the openvswitch kernel module to be available in the bootc image. A bootc image is started as a container that uses the host kernel. The host kernel might be different from the one used for building the image, resulting in a mismatch. A kernel version mismatch with the modules present in the /lib/modules directory means that the openvswitch module cannot be loaded in the container and the container fails to run. You can work around this problem by pre-loading the openvswitch module on the host.
Prerequisites
- A Red Hat Enterprise Linux (RHEL) 9.4 host with an active Red Hat subscription for building MicroShift bootc images and running containers.
-
You are logged into the RHEL 9.4 host using the user credentials that have
sudopermissions.
Procedure
Check if the
openvswitchmodule is available for the current host kernel version by running the following command:$ find /lib/modules/$(uname -r) -name "openvswitch*"Example output
/lib/modules/5.14.0-427.28.1.el9_4.x86_64/kernel/net/openvswitch /lib/modules/5.14.0-427.28.1.el9_4.x86_64/kernel/net/openvswitch/openvswitch.ko.xzSet the
IMAGE_NAMEenvironment variable by running the following command:$ IMAGE_NAME=microshift-4.17-bootcCheck the version of the kernel-core
packageused in the bootc image by running the following command:$ sudo podman inspect "${IMAGE_NAME}" | grep kernel-coreExample output
"created_by": "kernel-core-5.14.0-427.26.1.el9_4.x86_64"1 - 1
- The kernel version does not match the output of the
/lib/modulesdirectory.
Preinstall the
openvswitchmodule on the host as a workaround by running the following command:$ sudo modprobe openvswitch
1.4.2. Checking the host configuration for the MicroShift CSI リンクのコピーリンクがクリップボードにコピーされました!
If the host is already configured to have a volume group (VG) with free space, that configuration is inherited by the container. The VG can be used by the MicroShift Logical Volume Manager (LVM) Container Storage Interface (CSI) to allocate storage.
Prerequisites
- A Red Hat Enterprise Linux (RHEL) 9.4 host with an active Red Hat subscription for building MicroShift bootc images and running containers.
-
You are logged into the RHEL 9.4 host using the user credentials that have
sudopermissions.
Procedure
Determine if the volume group exists and it has the necessary free space by running the following command:
$ sudo vgsExample output for existing volume group
VG #PV #LV #SN Attr VSize VFree1 rhel 1 1 0 wz--n- <91.02g <2.02g- 1
- If no free volume group is present, the output is either empty or the
VFreevalue is 0.
注記If the host has a volume group with the available needed storage, you can run your container now. You do not need to configure the MicroShift CSI further.
重要If you do not have a volume group, you must set one up for the LVM CSI to allocate storage in bootc MicroShift containers. See the additional resources for more information.
Additional resources
1.4.3. Configuring container storage for the bootc image and the MicroShift CSI リンクのコピーリンクがクリップボードにコピーされました!
Use this procedure when a volume group with the necessary storage is not available on the host. Create and allocate an additional LVM volume group loop device to be shared with the container and used by the MicroShift Logical Volume Manager (LVM) Container Storage Interface (CSI).
If you found a volume group with adequate space when you checked the host configuration for the MicroShift CSI, you do not need to complete this step. Proceed to running your bootc image.
Prerequisites
- A Red Hat Enterprise Linux (RHEL) 9.4 host with an active Red Hat subscription for building MicroShift bootc images and running containers.
-
You are logged into the RHEL 9.4 host using the user credentials that have
sudopermissions.
Procedure
Create a file to be used for LVM partitioning by running the following command:
VGFILE=/var/lib/microshift-lvm-storage.img sudo losetup -f "${VGFILE}"Resize the file to your specified size by running the following command:
VGSIZE=1G1 $ sudo truncate --size="${VGSIZE}" "${VGFILE}"- 1
- Specify the size for the file.
Query the loop device name by running the following command:
$ VGLOOP=$(losetup -j ${VGFILE} | cut -d: -f1)Create a free volume group on the loop device by running the following command:
$ sudo vgcreate -f -y <my-volume-group> "${VGLOOP}"1 - 1
- Replace <my-volume-group> with the name of the volume group you are creating.