https://github.com/anza-labs/kubelet-device-plugins
Minimal device plugins integrating linux devices into Kubernetes.
https://github.com/anza-labs/kubelet-device-plugins
hacktoberfest kubelet kvm tap tun
Last synced: 7 months ago
JSON representation
Minimal device plugins integrating linux devices into Kubernetes.
- Host: GitHub
- URL: https://github.com/anza-labs/kubelet-device-plugins
- Owner: anza-labs
- License: apache-2.0
- Created: 2025-03-17T09:46:37.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-24T21:52:17.000Z (7 months ago)
- Last Synced: 2025-03-24T22:30:54.510Z (7 months ago)
- Topics: hacktoberfest, kubelet, kvm, tap, tun
- Language: Go
- Homepage:
- Size: 85.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# kubelet-device-plugins
[][license]
[](code_of_conduct.md)
[](https://github.com/anza-labs/kubelet-device-plugins/issues)
[](https://GitHub.com/anza-labs/kubelet-device-plugins/releases/)
[](https://goreportcard.com/report/github.com/anza-labs/kubelet-device-plugins)`kubelet-device-plugins` is a Kubernetes Device Plugin that manages access to Linux devices.
- [kubelet-device-plugins](#kubelet-device-plugins)
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [KVM](#kvm)
- [TUN](#tun)
- [How It Works](#how-it-works)
- [Compatibility](#compatibility)
- [License](#license)
- [Attributions](#attributions)## Features
- Provides access to Linux devices for containers running in Kubernetes.
- Implements the Kubernetes Device Plugin API to manage device allocation.
- Ensures that only workloads explicitly requesting device access receive it.## Installation
To deploy the `kubelet-device-plugins`, apply the provided manifests:
```sh
LATEST="$(curl -s 'https://api.github.com/repos/anza-labs/kubelet-device-plugins/releases/latest' | jq -r '.tag_name')"
kubectl apply -k "https://github.com/anza-labs/kubelet-device-plugins/?ref=${LATEST}"
```## Usage
### KVM
To request access to `/dev/kvm` in a pod, specify the device resource in the `resources` section:
```yaml
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
```### TUN
To request access to `tun` in a pod, specify the device resource in the `resources` section:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: kvm-checker
spec:
restartPolicy: Never
containers:
- name: kvm-checker
image: busybox
command: ["sh", "-c", "[ -e /dev/net/tun ]"]
resources:
requests:
devices.anza-labs.dev/tun: '1' # Request TUN device
limits:
devices.anza-labs.dev/tun: '1' # Limit TUN device
```## How It Works
1. The `kubelet-device-plugins` 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
`kubelet-device-plugins` are licensed under the [Apache-2.0][license].
## Attributions
This codebase is inspired by:
- [github.com/squat/generic-device-plugin](https://github.com/squat/generic-device-plugin)
- [github.com/kubevirt/kubernetes-device-plugins](https://github.com/kubevirt/kubernetes-device-plugins)[license]: https://github.com/anza-labs/kubelet-device-plugins/blob/main/LICENSE