Jump to: navigation, search

Difference between revisions of "StarlingX/Containers/Applications/app-kernel-module-management"

(Created page with "= Application: app-kernel-module-management = == Source == * [https://opendev.org/starlingx/app-kernel-module-management Code Repository] * [https://review.opendev.org/q/proje...")
 
(No difference)

Latest revision as of 19:35, 18 February 2026

Application: app-kernel-module-management

Source

Tarball Package

  • Get the .tgz file located at:
/usr/local/share/applications/helm/kernel-module-management*.tgz 
  • From Debian Build environment:
build-pkgs -c -p kernel-module-management-helm, python3-k8sapp-kernel-module-management, stx-kernel-module-management-helm

Common Commands

  • Get list of enabled/disabled kernel-module-management application charts
system helm-override-list kernel-module-management --long
  • Check kernel-module-management overrides
 system helm-override-show kernel-module-management kernel-module-management kernel-module-management
  • Apply overrides
system helm-override-update kernel-module-management kernel-module-management kernel-module-management --values <override_file>
  • Get kernel-module-management pods list
kubectl get pods -n kernel-module-management
  • Apply/Abort/Remove dell-storage application
system application-<apply/abort/remove> kernel-module-management

Testing

Installing application

  • Upload the application.
system application-upload /usr/local/share/applications/helm/kernel-module-management-*.tgz

The kernel-module-management app requires a docker registry to manage the module images it builds. The app uses this registry to pull and push images. This registry can be either external, or it may be a local registry. The following tests assume that you have already correctly configured either an external registry or a local registry, as described below.

  • Set the local registry docker credentials.
USERNAME="sysinv"
PASSWORD=$(keyring get sysinv services)
DOCKER_CREDENTIALS=$(echo -n "${USERNAME}":"${PASSWORD}" | base64
  • Create a docker-config.json.
cat >docker-config.json<<EOF
{
  "auths": {
      "https://registry.local:9001": {
         "auth": "$DOCKER_CREDENTIALS"
      }
  }
}
EOF

dconfigjson=$(cat docker-config.json | base64 -w 0)
  • Create a registry override file.
cat >kmm-app-override.yaml<<EOF
dockerRegistrySecretName: "kmm-registry-secret"
dockerConfigJson: "$dconfigjson"
EOF
  • Apply the overrides.
system helm-override-update kernel-module-management kernel-module-management kernel-module-management --values kmm-app-override.yaml
  • Apply the application.
system application-apply kernel-module-management
  • Verify if the controller and webhook pods are running.
sysadmin@controller-0(keystone_admin)]$ kubectl get pods -n kernel-module-management
NAME                                       READY   STATUS    RESTARTS   AGE
kmm-operator-controller-86dfc6bff8-swvf7   1/1     Running   0          97s
kmm-operator-webhook-788f76bd7c-64t6t      1/1     Running   0          97s


Building and loading modules

  • Creating the module file

To build and load a module it is necessary to have a Module ConfigMap and a Module Custom Resource Definition. Inside the pre-built image with the starlingx kernel headers, there is a hello_world module example ready to be tested with the kernel-module-management app.

cat << 'EOF' > hello_world_cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: kmm-hello-world-cm
  namespace: kernel-module-management
data:
  dockerfile: |
    FROM docker.io/starlingx/kmm-builder:stx.12.0-v1.0.0 as builder
    ARG KERNEL_FULL_VERSION
    RUN make KERNEL_DIR=/lib/modules/${KERNEL_FULL_VERSION}/build && \
        mkdir -p /opt/lib/modules/${KERNEL_FULL_VERSION} && \
        cp -v ./* /opt/lib/modules/${KERNEL_FULL_VERSION}
    RUN depmod -b /opt ${KERNEL_FULL_VERSION}
EOF
  • Create the Module CRD
cat << 'EOF' > hello_world_mod.yaml
apiVersion: kmm.sigs.x-k8s.io/v1beta1
kind: Module
metadata:
  name: kmm-hello-world
  namespace: kernel-module-management
spec:
  moduleLoader:
    container:
      modprobe:
        moduleName: hello_world_dmesg
      kernelMappings:
        - literal: "6.12.0-1-amd64"
          containerImage: registry.local:9001/kmm/kmm-hello-world:amd64-hw
          build:
            buildArgs:
              - name: KERNEL_FULL_VERSION
                value: "6.12.0-1-amd64"
            baseImageRegistryTLS:
              insecure: false
              insecureSkipTLSVerify: true
            dockerfileConfigMap:
              name: kmm-hello-world-cm
          registryTLS:
            insecure: false
            insecureSkipTLSVerify: true

        - literal: "6.12.0-1-rt-amd64"
          containerImage: registry.local:9001/kmm/kmm-hello-world:rt-amd64-hw
          build:
            buildArgs:
              - name: KERNEL_FULL_VERSION
                value: "6.12.0-1-rt-amd64"
            baseImageRegistryTLS:
              insecure: false
              insecureSkipTLSVerify: true
            dockerfileConfigMap:
              name: kmm-hello-world-cm
          registryTLS:
            insecure: false
            insecureSkipTLSVerify: true

  imageRepoSecret:
    name: "kmm-registry-secret"

  selector:
    kubernetes.io/os: linux
    kubernetes.io/hostname: controller-0

  tolerations:
    - key: "services"
      operator: "Equal"
      value: "disabled"
      effect: "NoExecute"

EOF
  • Building and loading the modules.
kubectl apply -f hello_world_cm.yaml -f hello_world_mod.yaml
  • Follow the builder pod logs.
kubectl logs -n kernel-module-management kmm-hello-world-build-<POD_ID> -f
  • Check if the module was correctly loaded, an hello world log should exist.
sudo dmesg
[102422.922706] e1000 0000:00:03.0 enp0s3: Reset adapter
[102425.122913] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[102582.800513] e1000: enp0s3 NIC Link is Down
[102586.903818] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[103642.175972] Hello, world!

Unloading modules and uninstalling the application

  • Unload the module.
kubectl delete -f hello_world_cm.yaml -f hello_world_mod.yaml
  • Check if a goodbye message was logged.
sudo dmesg

[102586.903818] e1000: enp0s3 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
[103642.175972] Hello, world!
[104469.925530] Goodbye, world!
  • Uninstall the kernel-module-management application.
 system application-remove kernel-module-management