Este contenido no está disponible en el idioma seleccionado.
Chapter 4. Kernel Module Management Operator
Learn about the Kernel Module Management (KMM) Operator and how you can use it to deploy out-of-tree kernel modules and device plugins on OpenShift Container Platform clusters.
4.1. About the Kernel Module Management Operator Copiar enlaceEnlace copiado en el portapapeles!
The Kernel Module Management (KMM) Operator manages, builds, signs, and deploys out-of-tree kernel modules and device plugins on OpenShift Container Platform clusters.
KMM adds a new Module CRD which describes an out-of-tree kernel module and its associated device plugin. You can use Module resources to configure how to load the module, define ModuleLoader images for kernel versions, and include instructions for building and signing modules for specific kernel versions.
KMM is designed to accommodate multiple kernel versions at once for any kernel module, allowing for seamless node upgrades and reduced application downtime.
4.2. Installing the Kernel Module Management Operator Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can install the Kernel Module Management (KMM) Operator by using the OpenShift CLI or the web console.
The KMM Operator is supported on OpenShift Container Platform 4.12 and later. Installing KMM on version 4.11 does not require specific additional steps. For details on installing KMM on version 4.10 and earlier, see the section "Installing the Kernel Module Management Operator on earlier versions of OpenShift Container Platform".
4.2.1. Installing the Kernel Module Management Operator using the web console Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can install the Kernel Module Management (KMM) Operator using the OpenShift Container Platform web console.
Procedure
- Log in to the OpenShift Container Platform web console.
Install the Kernel Module Management Operator:
-
In the OpenShift Container Platform web console, click Operators
OperatorHub. - Select Kernel Module Management Operator from the list of available Operators, and then click Install.
- On the Install Operator page, select the Installation mode as A specific namespace on the cluster.
-
From the Installed Namespace list, select the
openshift-kmmnamespace. - Click Install.
-
In the OpenShift Container Platform web console, click Operators
Verification
To verify that KMM Operator installed successfully:
-
Navigate to the Operators
Installed Operators page. Ensure that Kernel Module Management Operator is listed in the openshift-kmm project with a Status of InstallSucceeded.
NoteDuring installation, an Operator might display a Failed status. If the installation later succeeds with an InstallSucceeded message, you can ignore the Failed message.
Troubleshooting
To troubleshoot issues with Operator installation:
-
Navigate to the Operators
Installed Operators page and inspect the Operator Subscriptions and Install Plans tabs for any failure or errors under Status. -
Navigate to the Workloads
Pods page and check the logs for pods in the openshift-kmmproject.
-
Navigate to the Operators
4.2.2. Installing the Kernel Module Management Operator by using the CLI Copiar enlaceEnlace copiado en el portapapeles!
As a cluster administrator, you can install the Kernel Module Management (KMM) Operator by using the OpenShift CLI.
Prerequisites
- You have a running OpenShift Container Platform cluster.
-
You installed the OpenShift CLI (
oc). -
You are logged into the OpenShift CLI as a user with
cluster-adminprivileges.
Procedure
Install KMM in the
openshift-kmmnamespace:Create the following
NamespaceCR and save the YAML file, for example,kmm-namespace.yaml:apiVersion: v1 kind: Namespace metadata: name: openshift-kmm
apiVersion: v1 kind: Namespace metadata: name: openshift-kmmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
OperatorGroupCR and save the YAML file, for example,kmm-op-group.yaml:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: kernel-module-management namespace: openshift-kmm
apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: kernel-module-management namespace: openshift-kmmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
SubscriptionCR and save the YAML file, for example,kmm-sub.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the subscription object by running the following command:
oc create -f kmm-sub.yaml
$ oc create -f kmm-sub.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that the Operator deployment is successful, run the following command:
oc get -n openshift-kmm deployments.apps kmm-operator-controller-manager
$ oc get -n openshift-kmm deployments.apps kmm-operator-controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY UP-TO-DATE AVAILABLE AGE kmm-operator-controller-manager 1/1 1 1 97s
NAME READY UP-TO-DATE AVAILABLE AGE kmm-operator-controller-manager 1/1 1 1 97sCopy to Clipboard Copied! Toggle word wrap Toggle overflow The Operator is available.
4.2.3. Installing the Kernel Module Management Operator on earlier versions of OpenShift Container Platform Copiar enlaceEnlace copiado en el portapapeles!
The KMM Operator is supported on OpenShift Container Platform 4.12 and later. For version 4.10 and earlier, you must create a new SecurityContextConstraint object and bind it to the Operator’s ServiceAccount. As a cluster administrator, you can install the Kernel Module Management (KMM) Operator by using the OpenShift CLI.
Prerequisites
- You have a running OpenShift Container Platform cluster.
-
You installed the OpenShift CLI (
oc). -
You are logged into the OpenShift CLI as a user with
cluster-adminprivileges.
Procedure
Install KMM in the
openshift-kmmnamespace:Create the following
NamespaceCR and save the YAML file, for example,kmm-namespace.yamlfile:apiVersion: v1 kind: Namespace metadata: name: openshift-kmm
apiVersion: v1 kind: Namespace metadata: name: openshift-kmmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
SecurityContextConstraintobject and save the YAML file, for example,kmm-security-constraint.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Bind the
SecurityContextConstraintobject to the Operator’sServiceAccountby running the following commands:oc apply -f kmm-security-constraint.yaml
$ oc apply -f kmm-security-constraint.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc adm policy add-scc-to-user kmm-security-constraint -z kmm-operator-controller-manager -n openshift-kmm
$ oc adm policy add-scc-to-user kmm-security-constraint -z kmm-operator-controller-manager -n openshift-kmmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
OperatorGroupCR and save the YAML file, for example,kmm-op-group.yaml:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: kernel-module-management namespace: openshift-kmm
apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: kernel-module-management namespace: openshift-kmmCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the following
SubscriptionCR and save the YAML file, for example,kmm-sub.yaml:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the subscription object by running the following command:
oc create -f kmm-sub.yaml
$ oc create -f kmm-sub.yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that the Operator deployment is successful, run the following command:
oc get -n openshift-kmm deployments.apps kmm-operator-controller-manager
$ oc get -n openshift-kmm deployments.apps kmm-operator-controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY UP-TO-DATE AVAILABLE AGE kmm-operator-controller-manager 1/1 1 1 97s
NAME READY UP-TO-DATE AVAILABLE AGE kmm-operator-controller-manager 1/1 1 1 97sCopy to Clipboard Copied! Toggle word wrap Toggle overflow The Operator is available.
4.3. Kernel module deployment Copiar enlaceEnlace copiado en el portapapeles!
For each Module resource, Kernel Module Management (KMM) can create a number of DaemonSet resources:
-
One ModuleLoader
DaemonSetper compatible kernel version running in the cluster. -
One device plugin
DaemonSet, if configured.
The module loader daemon set resources run ModuleLoader images to load kernel modules. A module loader image is an OCI image that contains the .ko files and both the modprobe and sleep binaries.
When the module loader pod is created, the pod runs modprobe to insert the specified module into the kernel. It then enters a sleep state until it is terminated. When that happens, the ExecPreStop hook runs modprobe -r to unload the kernel module.
If the .spec.devicePlugin attribute is configured in a Module resource, then KMM creates a device plugin daemon set in the cluster. That daemon set targets:
-
Nodes that match the
.spec.selectorof theModuleresource. -
Nodes with the kernel module loaded (where the module loader pod is in the
Readycondition).
4.3.1. The Module custom resource definition Copiar enlaceEnlace copiado en el portapapeles!
The Module custom resource definition (CRD) represents a kernel module that can be loaded on all or select nodes in the cluster, through a module loader image. A Module custom resource (CR) specifies one or more kernel versions with which it is compatible, and a node selector.
The compatible versions for a Module resource are listed under .spec.moduleLoader.container.kernelMappings. A kernel mapping can either match a literal version, or use regexp to match many of them at the same time.
The reconciliation loop for the Module resource runs the following steps:
-
List all nodes matching
.spec.selector. - Build a set of all kernel versions running on those nodes.
For each kernel version:
-
Go through
.spec.moduleLoader.container.kernelMappingsand find the appropriate container image name. If the kernel mapping hasbuildorsigndefined and the container image does not already exist, run the build, the signing job, or both, as needed. - Create a module loader daemon set with the container image determined in the previous step.
-
If
.spec.devicePluginis defined, create a device plugin daemon set using the configuration specified under.spec.devicePlugin.container.
-
Go through
Run
garbage-collecton:- Existing daemon set resources targeting kernel versions that are not run by any node in the cluster.
- Successful build jobs.
- Successful signing jobs.
4.3.2. Security and permissions Copiar enlaceEnlace copiado en el portapapeles!
Loading kernel modules is a highly sensitive operation. After they are loaded, kernel modules have all possible permissions to do any kind of operation on the node.
4.3.2.1. ServiceAccounts and SecurityContextConstraints Copiar enlaceEnlace copiado en el portapapeles!
Kernel Module Management (KMM) creates a privileged workload to load the kernel modules on nodes. That workload needs ServiceAccounts allowed to use the privileged SecurityContextConstraint (SCC) resource.
The authorization model for that workload depends on the namespace of the Module resource, as well as its spec.
-
If the
.spec.moduleLoader.serviceAccountNameor.spec.devicePlugin.serviceAccountNamefields are set, they are always used. If those fields are not set, then:
-
If the
Moduleresource is created in the operator’s namespace (openshift-kmmby default), then KMM uses its default, powerfulServiceAccountsto run the daemon sets. -
If the
Moduleresource is created in any other namespace, then KMM runs the daemon sets as the namespace’sdefaultServiceAccount. TheModuleresource cannot run a privileged workload unless you manually enable it to use theprivilegedSCC.
-
If the
openshift-kmm is a trusted namespace.
When setting up RBAC permissions, remember that any user or ServiceAccount creating a Module resource in the openshift-kmm namespace results in KMM automatically running privileged workloads on potentially all nodes in the cluster.
To allow any ServiceAccount to use the privileged SCC and therefore to run module loader or device plugin pods, use the following command:
oc adm policy add-scc-to-user privileged -z "${serviceAccountName}" [ -n "${namespace}" ]
$ oc adm policy add-scc-to-user privileged -z "${serviceAccountName}" [ -n "${namespace}" ]
4.3.2.2. Pod security standards Copiar enlaceEnlace copiado en el portapapeles!
OpenShift runs a synchronization mechanism that sets the namespace Pod Security level automatically based on the security contexts in use. No action is needed.
4.3.3. Example Module CR Copiar enlaceEnlace copiado en el portapapeles!
The following is an annotated Module example:
- 1 1 1
- Required.
- 2
- Optional.
- 3
- Optional: Copies
/firmware/*into/var/lib/firmware/on the node. - 4
- Optional.
- 5
- At least one kernel item is required.
- 6
- For each node running a kernel matching the regular expression, KMM creates a
DaemonSetresource running the image specified incontainerImagewith${KERNEL_FULL_VERSION}replaced with the kernel version. - 7
- For any other kernel, build the image using the Dockerfile in the
my-kmodConfigMap. - 8
- Optional.
- 9
- Optional: A value for
some-kubernetes-secretcan be obtained from the build environment at/run/secrets/some-kubernetes-secret. - 10
- Optional: Avoid using this parameter. If set to
true, the build is allowed to pull the image in the DockerfileFROMinstruction using plain HTTP. - 11
- Optional: Avoid using this parameter. If set to
true, the build will skip any TLS server certificate validation when pulling the image in the DockerfileFROMinstruction using plain HTTP. - 12
- Required.
- 13
- Required: A secret holding the public secureboot key with the key 'cert'.
- 14
- Required: A secret holding the private secureboot key with the key 'key'.
- 15
- Optional: Avoid using this parameter. If set to
true, KMM will be allowed to check if the container image already exists using plain HTTP. - 16
- Optional: Avoid using this parameter. If set to
true, KMM will skip any TLS server certificate validation when checking if the container image already exists. - 17
- Optional.
- 18
- Optional.
- 19
- Required: If the device plugin section is present.
- 20
- Optional.
- 21
- Optional.
- 22
- Optional.
- 23
- Optional: Used to pull module loader and device plugin images.
4.4. Using a ModuleLoader image Copiar enlaceEnlace copiado en el portapapeles!
Kernel Module Management (KMM) works with purpose-built module loader images. These are standard OCI images that must satisfy the following requirements:
-
.kofiles must be located in/opt/lib/modules/${KERNEL_VERSION}. -
modprobeandsleepbinaries must be defined in the$PATHvariable.
4.4.1. Running depmod Copiar enlaceEnlace copiado en el portapapeles!
If your module loader image contains several kernel modules and if one of the modules depends on another module, it is best practice to run depmod at the end of the build process to generate dependencies and map files.
You must have a Red Hat subscription to download the kernel-devel package.
Procedure
-
To generate
modules.depand.mapfiles for a specific kernel version, rundepmod -b /opt ${KERNEL_VERSION}.
4.4.1.1. Example Dockerfile Copiar enlaceEnlace copiado en el portapapeles!
If you are building your image on OpenShift Container Platform, consider using the Driver Tool Kit (DTK).
For further information, see using an entitled build.
4.4.2. Building in the cluster Copiar enlaceEnlace copiado en el portapapeles!
KMM can build module loader images in the cluster. Follow these guidelines:
-
Provide build instructions using the
buildsection of a kernel mapping. -
Copy the Dockerfile for your container image into a
ConfigMapresource, under thedockerfilekey. -
Ensure that the
ConfigMapis located in the same namespace as theModule.
KMM checks if the image name specified in the containerImage field exists. If it does, the build is skipped.
Otherwise, KMM creates a Build resource to build your image. After the image is built, KMM proceeds with the Module reconciliation. See the following example.
- 1
- Optional.
- 2
- Optional.
- 3
- Will be mounted in the build pod as
/run/secrets/some-kubernetes-secret. - 4
- Optional: Avoid using this parameter. If set to
true, the build will be allowed to pull the image in the DockerfileFROMinstruction using plain HTTP. - 5
- Optional: Avoid using this parameter. If set to
true, the build will skip any TLS server certificate validation when pulling the image in the DockerfileFROMinstruction using plain HTTP. - 6
- Required.
- 7
- Optional: Avoid using this parameter. If set to
true, KMM will be allowed to check if the container image already exists using plain HTTP. - 8
- Optional: Avoid using this parameter. If set to
true, KMM will skip any TLS server certificate validation when checking if the container image already exists.
4.4.3. Using the Driver Toolkit Copiar enlaceEnlace copiado en el portapapeles!
The Driver Toolkit (DTK) is a convenient base image for building build module loader images. It contains tools and libraries for the OpenShift version currently running in the cluster.
Procedure
Use DTK as the first stage of a multi-stage Dockerfile.
- Build the kernel modules.
-
Copy the
.kofiles into a smaller end-user image such asubi-minimal. To leverage DTK in your in-cluster build, use the
DTK_AUTObuild argument. The value is automatically set by KMM when creating theBuildresource. See the following example.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.5. Using signing with Kernel Module Management (KMM) Copiar enlaceEnlace copiado en el portapapeles!
On a Secure Boot enabled system, all kernel modules (kmods) must be signed with a public/private key-pair enrolled into the Machine Owner’s Key (MOK) database. Drivers distributed as part of a distribution should already be signed by the distribution’s private key, but for kernel modules build out-of-tree, KMM supports signing kernel modules using the sign section of the kernel mapping.
For more details on using Secure Boot, see Generating a public and private key pair
Prerequisites
- A public private key pair in the correct (DER) format.
- At least one secure-boot enabled node with the public key enrolled in its MOK database.
- Either a pre-built driver container image, or the source code and Dockerfile needed to build one in-cluster.
4.6. Adding the keys for secureboot Copiar enlaceEnlace copiado en el portapapeles!
To use KMM Kernel Module Management (KMM) to sign kernel modules, a certificate and private key are required. For details on how to create these, see Generating a public and private key pair.
For details on how to extract the public and private key pair, see Signing kernel modules with the private key. Use steps 1 through 4 to extract the keys into files.
Procedure
Create the
sb_cert.cerfile that contains the certificate and thesb_cert.privfile that contains the private key:openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -config configuration_file.config -outform DER -out my_signing_key_pub.der -keyout my_signing_key.priv
$ openssl req -x509 -new -nodes -utf8 -sha256 -days 36500 -batch -config configuration_file.config -outform DER -out my_signing_key_pub.der -keyout my_signing_key.privCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the files by using one of the following methods:
Add the files as secrets directly:
oc create secret generic my-signing-key --from-file=key=<my_signing_key.priv>
$ oc create secret generic my-signing-key --from-file=key=<my_signing_key.priv>Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc create secret generic my-signing-key-pub --from-file=cert=<my_signing_key_pub.der>
$ oc create secret generic my-signing-key-pub --from-file=cert=<my_signing_key_pub.der>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the files by base64 encoding them:
cat sb_cert.priv | base64 -w 0 > my_signing_key2.base64
$ cat sb_cert.priv | base64 -w 0 > my_signing_key2.base64Copy to Clipboard Copied! Toggle word wrap Toggle overflow cat sb_cert.cer | base64 -w 0 > my_signing_key_pub.base64
$ cat sb_cert.cer | base64 -w 0 > my_signing_key_pub.base64Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Add the encoded text to a YAML file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the YAML file:
oc apply -f <yaml_filename>
$ oc apply -f <yaml_filename>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6.1. Checking the keys Copiar enlaceEnlace copiado en el portapapeles!
After you have added the keys, you must check them to ensure they are set correctly.
Procedure
Check to ensure the public key secret is set correctly:
oc get secret -o yaml <certificate secret name> | awk '/cert/{print $2; exit}' | base64 -d | openssl x509 -inform der -text$ oc get secret -o yaml <certificate secret name> | awk '/cert/{print $2; exit}' | base64 -d | openssl x509 -inform der -textCopy to Clipboard Copied! Toggle word wrap Toggle overflow This should display a certificate with a Serial Number, Issuer, Subject, and more.
Check to ensure the private key secret is set correctly:
oc get secret -o yaml <private key secret name> | awk '/key/{print $2; exit}' | base64 -d$ oc get secret -o yaml <private key secret name> | awk '/key/{print $2; exit}' | base64 -dCopy to Clipboard Copied! Toggle word wrap Toggle overflow This should display the key enclosed in the
-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----lines.
4.7. Signing a pre-built driver container Copiar enlaceEnlace copiado en el portapapeles!
Use this procedure if you have a pre-built image, such as an image either distributed by a hardware vendor or built elsewhere.
The following YAML file adds the public/private key-pair as secrets with the required key names - key for the private key, cert for the public key. The cluster then pulls down the unsignedImage image, opens it, signs the kernel modules listed in filesToSign, adds them back, and pushes the resulting image as containerImage.
Kernel Module Management (KMM) should then deploy the DaemonSet that loads the signed kmods onto all the nodes that match the selector. The driver containers should run successfully on any nodes that have the public key in their MOK database, and any nodes that are not secure-boot enabled, which ignore the signature. They should fail to load on any that have secure-boot enabled but do not have that key in their MOK database.
Prerequisites
-
The
keySecretandcertSecretsecrets have been created.
Procedure
Apply the YAML file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- 1
modprobe- The name of the kmod to load.
4.8. Building and signing a ModuleLoader container image Copiar enlaceEnlace copiado en el portapapeles!
Use this procedure if you have source code and must build your image first.
The following YAML file builds a new container image using the source code from the repository. The image produced is saved back in the registry with a temporary name, and this temporary image is then signed using the parameters in the sign section.
The temporary image name is based on the final image name and is set to be <containerImage>:<tag>-<namespace>_<module name>_kmm_unsigned.
For example, using the following YAML file, Kernel Module Management (KMM) builds an image named example.org/repository/minimal-driver:final-default_example-module_kmm_unsigned containing the build with unsigned kmods and push it to the registry. Then it creates a second image named example.org/repository/minimal-driver:final that contains the signed kmods. It is this second image that is loaded by the DaemonSet object and deploys the kmods to the cluster nodes.
After it is signed, the temporary image can be safely deleted from the registry. It will be rebuilt, if needed.
Prerequisites
-
The
keySecretandcertSecretsecrets have been created.
Procedure
Apply the YAML file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- 1 2
namespace- Replacedefaultwith a valid namespace.- 3
serviceAccountName- The defaultserviceAccountNamedoes not have the required permissions to run a module that is privileged. For information on creating a service account, see "Creating service accounts" in the "Additional resources" of this section.- 4
imageRepoSecret- Used asimagePullSecretsin theDaemonSetobject and to pull and push for the build and sign features.
Additional resources
For information on creating a service account, see Creating service accounts.
4.9. Debugging and troubleshooting Copiar enlaceEnlace copiado en el portapapeles!
If the kmods in your driver container are not signed or are signed with the wrong key, then the container can enter a PostStartHookError or CrashLoopBackOff status. You can verify by running the oc describe command on your container, which displays the following message in this scenario:
modprobe: ERROR: could not insert '<your_kmod_name>': Required key not available
modprobe: ERROR: could not insert '<your_kmod_name>': Required key not available
4.10. KMM firmware support Copiar enlaceEnlace copiado en el portapapeles!
Kernel modules sometimes need to load firmware files from the file system. KMM supports copying firmware files from the ModuleLoader image to the node’s file system.
The contents of .spec.moduleLoader.container.modprobe.firmwarePath are copied into the /var/lib/firmware path on the node before running the modprobe command to insert the kernel module.
All files and empty directories are removed from that location before running the modprobe -r command to unload the kernel module, when the pod is terminated.
4.10.1. Configuring the lookup path on nodes Copiar enlaceEnlace copiado en el portapapeles!
On OpenShift Container Platform nodes, the set of default lookup paths for firmwares does not include the /var/lib/firmware path.
Procedure
Use the Machine Config Operator to create a
MachineConfigcustom resource (CR) that contains the/var/lib/firmwarepath:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- You can configure the label based on your needs. In the case of single-node OpenShift, use either
control-paneormasterobjects.
-
By applying the
MachineConfigCR, the nodes are automatically rebooted.
4.10.2. Building a ModuleLoader image Copiar enlaceEnlace copiado en el portapapeles!
Procedure
In addition to building the kernel module itself, include the binary firmware in the builder image:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.10.3. Tuning the Module resource Copiar enlaceEnlace copiado en el portapapeles!
Procedure
Set
.spec.moduleLoader.container.modprobe.firmwarePathin theModulecustom resource (CR):Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Optional: Copies
/firmware/*into/var/lib/firmware/on the node.
4.11. Troubleshooting KMM Copiar enlaceEnlace copiado en el portapapeles!
When troubleshooting KMM installation issues, you can monitor logs to determine at which stage issues occur. Then, retrieve diagnostic data relevant to that stage.
4.11.1. Using the must-gather tool Copiar enlaceEnlace copiado en el portapapeles!
The oc adm must-gather command is the preferred way to collect a support bundle and provide debugging information to Red Hat Support. Collect specific information by running the command with the appropriate arguments as described in the following sections.
4.11.1.1. Gathering data for KMM Copiar enlaceEnlace copiado en el portapapeles!
Procedure
Gather the data for the KMM Operator controller manager:
Set the
MUST_GATHER_IMAGEvariable:export MUST_GATHER_IMAGE=$(oc get deployment -n openshift-kmm kmm-operator-controller-manager -ojsonpath='{.spec.template.spec.containers[?(@.name=="manager")].env[?(@.name=="RELATED_IMAGES_MUST_GATHER")].value}')$ export MUST_GATHER_IMAGE=$(oc get deployment -n openshift-kmm kmm-operator-controller-manager -ojsonpath='{.spec.template.spec.containers[?(@.name=="manager")].env[?(@.name=="RELATED_IMAGES_MUST_GATHER")].value}')Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUse the
-n <namespace>switch to specify a namespace if you installed KMM in a custom namespace.Run the
must-gathertool:oc adm must-gather --image="${MUST_GATHER_IMAGE}" -- /usr/bin/gather$ oc adm must-gather --image="${MUST_GATHER_IMAGE}" -- /usr/bin/gatherCopy to Clipboard Copied! Toggle word wrap Toggle overflow
View the Operator logs:
oc logs -fn openshift-kmm deployments/kmm-operator-controller-manager
$ oc logs -fn openshift-kmm deployments/kmm-operator-controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example 4.1. Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.11.1.2. Gathering data for KMM-Hub Copiar enlaceEnlace copiado en el portapapeles!
Procedure
Gather the data for the KMM Operator hub controller manager:
Set the
MUST_GATHER_IMAGEvariable:export MUST_GATHER_IMAGE=$(oc get deployment -n openshift-kmm-hub kmm-operator-hub-controller-manager -ojsonpath='{.spec.template.spec.containers[?(@.name=="manager")].env[?(@.name=="RELATED_IMAGES_MUST_GATHER")].value}')$ export MUST_GATHER_IMAGE=$(oc get deployment -n openshift-kmm-hub kmm-operator-hub-controller-manager -ojsonpath='{.spec.template.spec.containers[?(@.name=="manager")].env[?(@.name=="RELATED_IMAGES_MUST_GATHER")].value}')Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUse the
-n <namespace>switch to specify a namespace if you installed KMM in a custom namespace.Run the
must-gathertool:oc adm must-gather --image="${MUST_GATHER_IMAGE}" -- /usr/bin/gather -u$ oc adm must-gather --image="${MUST_GATHER_IMAGE}" -- /usr/bin/gather -uCopy to Clipboard Copied! Toggle word wrap Toggle overflow
View the Operator logs:
oc logs -fn openshift-kmm-hub deployments/kmm-operator-hub-controller-manager
$ oc logs -fn openshift-kmm-hub deployments/kmm-operator-hub-controller-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example 4.2. Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.12. KMM hub and spoke Copiar enlaceEnlace copiado en el portapapeles!
In hub and spoke scenarios, many spoke clusters are connected to a central, powerful hub cluster. Kernel Module Management (KMM) depends on Red Hat Advanced Cluster Management (RHACM) to operate in hub and spoke environments.
KMM is compatible with hub and spoke environments through decoupling KMM features. A ManagedClusterModule Custom Resource Definition (CRD) is provided to wrap the existing Module CRD and extend it to select Spoke clusters. Also provided is KMM-Hub, a new standalone controller that builds images and signs modules on the hub cluster.
In hub and spoke setups, spokes are focused, resource-constrained clusters that are centrally managed by a hub cluster. Spokes run the single-cluster edition of KMM, with those resource-intensive features disabled. To adapt KMM to this environment, you should reduce the workload running on the spokes to the minimum, while the hub takes care of the expensive tasks.
Building kernel module images and signing the .ko files, should run on the hub. The scheduling of the Module Loader and Device Plugin DaemonSets can only happen on the spokes.
4.12.1. KMM-Hub Copiar enlaceEnlace copiado en el portapapeles!
The KMM project provides KMM-Hub, an edition of KMM dedicated to hub clusters. KMM-Hub monitors all kernel versions running on the spokes and determines the nodes on the cluster that should receive a kernel module.
KMM-Hub runs all compute-intensive tasks such as image builds and kmod signing, and prepares the trimmed-down Module to be transferred to the spokes through RHACM.
KMM-Hub cannot be used to load kernel modules on the hub cluster. Install the regular edition of KMM to load kernel modules.
4.12.2. Installing KMM-Hub Copiar enlaceEnlace copiado en el portapapeles!
You can use one of the following methods to install KMM-Hub:
- Using the Operator Lifecycle Manager (OLM)
- Creating KMM resources
4.12.2.1. Installing KMM-Hub using the Operator Lifecycle Manager Copiar enlaceEnlace copiado en el portapapeles!
Use the Operators section of the OpenShift console to install KMM-Hub.
4.12.2.2. Installing KMM-Hub by creating KMM resources Copiar enlaceEnlace copiado en el portapapeles!
Procedure
-
If you want to install KMM-Hub programmatically, you can use the following resources to create the
Namespace,OperatorGroupandSubscriptionresources:
4.12.3. Using the ManagedClusterModule CRD Copiar enlaceEnlace copiado en el portapapeles!
Use the ManagedClusterModule Custom Resource Definition (CRD) to configure the deployment of kernel modules on spoke clusters. This CRD is cluster-scoped, wraps a Module spec and adds the following additional fields:
If build or signing instructions are present in .spec.moduleSpec, those pods are run on the hub cluster in the operator’s namespace.
When the .spec.selector matches one or more ManagedCluster resources, then KMM-Hub creates a ManifestWork resource in the corresponding namespace(s). ManifestWork contains a trimmed-down Module resource, with kernel mappings preserved but all build and sign subsections are removed. containerImage fields that contain image names ending with a tag are replaced with their digest equivalent.
4.12.4. Running KMM on the spoke Copiar enlaceEnlace copiado en el portapapeles!
After installing KMM on the spoke, no further action is required. Create a ManagedClusterModule object from the hub to deploy kernel modules on spoke clusters.
Procedure
You can install KMM on the spokes cluster through a RHACM Policy object. In addition to installing KMM from the Operator hub and running it in a lightweight spoke mode, the Policy configures additional RBAC required for the RHACM agent to be able to manage Module resources.
Use the following RHACM policy to install KMM on spoke clusters:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The
spec.clusterSelectorfield can be customized to target select clusters only.