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 sudo permissions.

Procedure

  1. Check if the openvswitch module 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.xz

  2. Set the IMAGE_NAME environment variable by running the following command:

    $ IMAGE_NAME=microshift-4.17-bootc
  3. Check the version of the kernel-core package used in the bootc image by running the following command:

    $ sudo podman inspect "${IMAGE_NAME}" | grep kernel-core

    Example 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/modules directory.
  4. Preinstall the openvswitch module on the host as a workaround by running the following command:

    $ sudo modprobe openvswitch

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 sudo permissions.

Procedure

  1. Determine if the volume group exists and it has the necessary free space by running the following command:

    $ sudo vgs

    Example output for existing volume group

      VG   #PV #LV #SN Attr   VSize   VFree 
    1
    
      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 VFree value 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.

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 sudo permissions.

Procedure

  1. 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}"
  2. Resize the file to your specified size by running the following command:

    VGSIZE=1G 
    1
    
    
    $ sudo truncate --size="${VGSIZE}" "${VGFILE}"
    1
    Specify the size for the file.
  3. Query the loop device name by running the following command:

    $ VGLOOP=$(losetup -j ${VGFILE} | cut -d: -f1)
  4. 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.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部