A container and example partial pod spec for modprobe for loading kernel modules.
  • Dockerfile 100%
Find a file
Emily Shepherd c175a4b78b
Include patch for statically building kmod
This has been taken from an open [issue][gh-389] on the kmod project.

[gh-389]: https://github.com/kmod-project/kmod/issues/389
2025-08-05 23:22:11 +01:00
src@13330c958d Initial Commit 2025-08-05 19:50:14 +01:00
.gitmodules Switch to GitHub for kmod 2025-08-05 20:19:19 +01:00
Containerfile Include patch for statically building kmod 2025-08-05 23:22:11 +01:00
LICENSE Add LICENSE 2025-08-05 19:52:51 +01:00
meson-add-support-for-static-builds.patch Include patch for statically building kmod 2025-08-05 23:22:11 +01:00
README.md Add sample Pod manifest snippets 2025-08-05 20:09:39 +01:00

modprobe

Version Size

A container and example partial pod spec for modprobe, part of kmod, for loading kernel modules.

Usage

This container is designed to be used as an init container alongside other containers in a Kubernetes Pod. It is used when a pod requires certain kernel modules to be loaded. Using a separate container to perform this task means:

a) Application pods themselves do not need to be concerned with the implementation details of how modules are loaded on the system. b) the SYS_MODULE capability, which is extremely powerful, does not need to be granted to a Pod's main runtime containers.

Add this Container Spec to your Pod's initContainers section:

- name: modprobe
  image: docker.io/emilyls/modprobe:34.2
  args:
    - -a
    - tiny-power-button
    - binfmt-script

  volumeMounts:
    # As a wise man once said, "in order to be able to load kernel
    # modules, we must first be able to see the kernel modules"
    - mountPath: /lib/modules
      name: modules
      readOnly: true

  securityContext:
    readOnlyRootFilesystem: true
    capabilities:
      drop:
        - ALL
      add:
        # Required to allow modprobe to load the modules
        - SYS_MODULE

And add this Volume Spec to your Pod's volumes section:

- name: modules
  hostPath:
    type: Directory
    path: /lib/modules

License

kmod itself is licenced under GPLv2.1. This wrapper project's Containerfile and helm chart are licensed under the Apache License 2.0.