Deploying the Device Plugin
The Kubernetes Generic Device Plugin is a DaemonSet that runs on each node in the cluster, exposing the devices to the pods. The device plugin is configured with a list of devices to expose, e.g.--device='{"name": "video", "groups": [{"paths": [{"path": "/dev/video0"}]}]}.
In this guide, we will demonstrate how to deploy the device plugin with a configuration that exposes the /dev/net/tun device.
This device is commonly used for user-space Wireguard, including Tailscale.
The
/dev/net/tun device example used in this guide is for demonstration purposes only.
Talos 1.8 and above use a containerd version that is not affected by the runc v1.2.0 issue which removed access to tun devices.
This issue was reverted in runc v1.2.4, so the Generic Device Plugin is no longer needed specifically for tun/tap devices on modern Talos versions.
However, this guide remains useful as an example of how to expose other host devices to Kubernetes pods using device plugins.squat.ai/tun (the tun name comes from the name of the group in the device plugin configuration).:
Deploying a Pod with the Device
Now that the device plugin is deployed, you can deploy a pod that requests the device. The request for the device is specified as a resource in the pod spec./dev/net/tun device:
/dev/net/tun device available: