kvm-device-plugin

module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2025 License: Apache-2.0

README

kvm-device-plugin

GitHub License Contributor Covenant GitHub issues GitHub release Go Report Card

kvm-device-plugin is a Kubernetes Device Plugin that manages access to /dev/kvm (Kernel-based Virtual Machine) devices. It allows workloads running in Kubernetes to request KVM access via the Device Plugin interface, ensuring proper communication with the kubelet.

Features

  • Provides access to /dev/kvm for containers running in Kubernetes.
  • Implements the Kubernetes Device Plugin API to manage KVM allocation.
  • Ensures that only workloads explicitly requesting KVM access receive it.

Installation

To deploy the kvm-device-plugin, apply the provided manifests:

LATEST="$(curl -s 'https://api.github.com/repos/anza-labs/kvm-device-plugin/releases/latest' | jq -r '.tag_name')"
kubectl apply -k "https://github.com/anza-labs/kvm-device-plugin/?ref=${LATEST}"

Usage

To request access to /dev/kvm in a pod, specify the device resource in the resources section:

apiVersion: v1
kind: Pod
metadata:
  name: kvm-checker
spec:
  restartPolicy: Never
  containers:
    - name: kvm-checker
      image: busybox
      command: ["sh", "-c", "[ -e /dev/kvm ]"]
      resources:
        requests:
          devices.anza-labs.dev/kvm: '1' # Request KVM device
        limits:
          devices.anza-labs.dev/kvm: '1' # Limit KVM device

How It Works

  1. The kvm-device-plugin registers with the kubelet and advertises available KVM devices.
  2. When a pod requests the devices.anza-labs.dev/kvm resource, the device plugin assigns a /dev/kvm device to the container.
  3. The container is granted access to /dev/kvm for virtualization tasks.

Compatibility

  • Kubernetes 1.20+
  • Nodes must have KVM enabled (check with lsmod | grep kvm)

License

kvm-device-plugin is licensed under the Apache-2.0.

Attributions

This codebase is inspired by:

Directories

Path Synopsis
cmd
hack
cmd/release command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL