How to Run GPU Workloads on K3s Using NVIDIA GPU Operator 26.7

Updated on Sep 11, 2026
Kimberly N
9 MINS READ
Table of Contents
NVIDIA GPU Operator for K3s GPU Nodes

If you run AI or CUDA jobs on a real GPU server, you need Kubernetes to see the GPU and share it safely between pods. This guide shows you how to install NVIDIA GPU Operator 26.7 on K3s on a bare-metal server.

What Is NVIDIA GPU Operator

NVIDIA GPU Operator is a Kubernetes tool that automatically installs and manages everything a GPU needs inside your cluster. This includes the GPU driver, the NVIDIA Container Toolkit, the device plugin, GPU Feature Discovery, and the DCGM Exporter for monitoring. Instead of installing each of these manually on every server, the Operator does it for you as Kubernetes pods. 

Why Use K3s for Bare-Metal GPUs

K3s is a lightweight Kubernetes distribution. It is popular for bare-metal GPU servers because it is small, fast to install, and uses containerd as its container engine by default. 

K3s stores its containerd configuration files in a different folder than standard Kubernetes, so when you install NVIDIA GPU Operator 26.7 on K3s, you must tell the Operator where those K3s-specific files live. 

Prerequisites

Before you install NVIDIA GPU Operator 26.7 on K3s, make sure you have:

  • A bare-metal or dedicated server with an NVIDIA GPU.
  • Ubuntu 24.04 or newer installed and updated.
  • Root or sudo access over SSH.
  • At least 8 GB RAM and 4 CPU cores free for the master node. If you run workloads on the same node, plan for more.
  • Secure Boot turned off in BIOS, unless you plan to sign the NVIDIA kernel modules yourself. This avoids driver loading errors later.

If you need a ready GPU server instead of building one yourself, PerLod's GPU dedicated servers come with GPU hardware already racked and ready, so you can skip the hardware setup and go straight to this tutorial.

Step 1: Update the Server and Check the GPU

First, run the system update and reboot the server:

Bash
sudo apt update && sudo apt upgrade -ysudo reboot

After the server restarts, log in again and confirm Linux can see your GPU card at the hardware level:

Bash
lspci | grep -i nvidia

You should see a line like NVIDIA Corporation Device .... If nothing shows up, the GPU is not connected properly, or it is disabled in the BIOS. Fix that before continuing.

Step 2: Install the NVIDIA Driver on the Host

Here you have two choices. The default option is to let the GPU Operator install the driver inside a container automatically. Or, you can install the driver yourself on the host first and tell the Operator to skip driver installation. 

For bare-metal production servers, installing the driver on the host is more stable:

Bash
sudo apt install build-essential dkms -ysudo apt install ubuntu-drivers-common -yubuntu-drivers devices

The last command lists the recommended driver package for your card. Install it with the command below; just replace the version number:

Bash
sudo apt install nvidia-driver-570 -ysudo reboot

After reboot, check that the driver loaded correctly:

Bash
nvidia-smi

You should see a table with your GPU name, driver version, and memory. If this command fails, the driver did not install correctly, and you must fix it before moving to Kubernetes.

Step 3: Install K3s on the Bare-Metal Node

Now install K3s itself. This single command downloads and starts K3s as a systemd service:

Bash
curl -sfL https://get.k3s.io | sh -

Wait about a minute, then check that the node is ready:

Bash
sudo k3s kubectl get nodes

You should see your node with a Ready status. To make kubectl easier to use without typing k3s kubectl every time, copy the config file and set an environment variable:

Bash
mkdir -p ~/.kubesudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/configsudo chown $(id -u):$(id -g) ~/.kube/configexport KUBECONFIG=~/.kube/configecho "export KUBECONFIG=~/.kube/config" >> ~/.bashrc

Now plain kubectl get nodes will work from your normal user account too.

Step 4: Install Helm Package Manager

The GPU Operator is installed using Helm, which is a package manager for Kubernetes. Install it with the official script:

Bash
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3chmod 700 get_helm.sh./get_helm.sh

Check that Helm installed correctly:

Bash
helm version

Step 5: Add the NVIDIA Helm Repository

Add NVIDIA's official Helm chart repository and refresh it, so Helm knows where to find the GPU Operator chart:

Bash
helm repo add nvidia https://helm.ngc.nvidia.com/nvidiahelm repo update

Create a dedicated namespace and mark it as privileged, since GPU Operator pods need direct hardware access:

Bash
kubectl create ns gpu-operatorkubectl label --overwrite ns gpu-operator pod-security.kubernetes.io/enforce=privileged

Step 6: Install NVIDIA GPU Operator 26.7 on K3s

Because K3s stores its containerd config in a different location than standard Linux, we must pass extra --set options that point to the K3s paths. 

Since we already installed the driver on the host in Step 2, we set driver.enabled=false so the Operator does not try to install its own driver container on top of it:

Bash
helm install --wait gpu-operator \  -n gpu-operator --create-namespace \  nvidia/gpu-operator \  --version=v26.7.0 \  --set driver.enabled=false \  --set toolkit.env[0].name=CONTAINERD_CONFIG \  --set toolkit.env[0].value=/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl \  --set toolkit.env[1].name=CONTAINERD_SOCKET \  --set toolkit.env[1].value=/run/k3s/containerd/containerd.sock \  --set toolkit.env[2].name=RUNTIME_CONFIG_SOURCE \  --set toolkit.env[2].value="file=/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl"

This single command installs NVIDIA GPU Operator 26.7 on K3s with the correct settings for a bare-metal node. Helm will wait until all pods are running before returning your terminal prompt, which can take 3 to 6 minutes depending on your internet speed.

If you did not pre-install the driver in Step 2 and instead want the Operator to install it in a container, drop the driver.enabled=false line and simply run:

Bash
helm install --wait gpu-operator \  -n gpu-operator --create-namespace \  nvidia/gpu-operator \  --version=v26.7.0 \  --set toolkit.env[0].name=CONTAINERD_CONFIG \  --set toolkit.env[0].value=/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl \  --set toolkit.env[1].name=CONTAINERD_SOCKET \  --set toolkit.env[1].value=/run/k3s/containerd/containerd.sock

Step 7: Verify Every Operator Component Is Healthy

After you install NVIDIA GPU Operator 26.7 on K3s, do not skip verification. A pod stuck in CrashLoopBackOff here means your GPU workloads will silently fail later.

First, check that all pods in the gpu-operator namespace are running:

Bash
kubectl get pods -n gpu-operator

You are looking for output similar to this, where every pod says Running or Completed:

Bash
NAME                                         READY   STATUS      RESTARTS   AGEgpu-feature-discovery-7nwkb                  1/1     Running     0          6mnvidia-container-toolkit-daemonset-74gtl     1/1     Running     0          6mnvidia-cuda-validator-5m8l6                  0/1     Completed   0          4mnvidia-dcgm-exporter-tt5z5                   1/1     Running     0          6mnvidia-device-plugin-daemonset-t5zfq         1/1     Running     0          6mnvidia-operator-validator-m2h8f              1/1     Running     0          6m

Next, check the ClusterPolicy object, which controls all Operator behavior. It must show ready:

Bash
kubectl get clusterpolicy

Now confirm the GPU is registered as a schedulable resource in Kubernetes. This is the real proof that the Device Plugin is working correctly:

Bash
kubectl get nodes -o json | jq '.items[] | select(.status.allocatable["nvidia.com/gpu"] != null) | {name: .metadata.name, gpus: .status.allocatable["nvidia.com/gpu"]}'

You should see your node name with a gpus count matching your physical cards, for example "gpus": "1". If this returns nothing, check the toolkit and driver pod logs with the command below to find the exact error:

Bash
kubectl logs -n gpu-operator <pod-name>

Finally, check GPU Feature Discovery labels, which describe your GPU model and memory to Kubernetes as node labels:

Bash
kubectl get node $(hostname) -o json | jq '.metadata.labels | with_entries(select(.key | startswith("nvidia.com")))'

Step 8: Check DCGM Exporter Metrics

DCGM Exporter collects live GPU health data, such as temperature, utilization, and memory usage, and exposes it as Prometheus metrics. Confirm it is running and reachable:

Bash
kubectl get pods -n gpu-operator -l app=nvidia-dcgm-exporterkubectl port-forward -n gpu-operator svc/nvidia-dcgm-exporter 9400:9400

While that command runs, open a second terminal on the same server and pull the metrics:

Bash
curl -s http://localhost:9400/metrics | grep DCGM_FI_DEV_GPU_UTIL

If you see numbers coming back, DCGM Exporter is healthy, and you can later connect Prometheus or Grafana to this endpoint for long-term GPU monitoring.

Step 9: Schedule a CUDA Test Workload

Now that you have installed NVIDIA GPU Operator 26.7 on K3s and confirmed every component is healthy, it is time to prove the GPU actually works inside a container. Create a file to test it:

Bash
nano cuda-vectoradd.yaml

Paste this content into the file:

YAML
apiVersion: v1kind: Podmetadata:  name: cuda-vectoraddspec:  restartPolicy: OnFailure  containers:  - name: cuda-vectoradd    image: "nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0-ubuntu22.04"    resources:      limits:        nvidia.com/gpu: 1

Apply the file to create the pod with the command below:

Bash
kubectl apply -f cuda-vectoradd.yaml

Watch it run, then read its output with the following commands:

Bash
kubectl get pods -wkubectl logs pod/cuda-vectoradd

A working setup prints a message ending in Test PASSED and Done. This means the pod successfully asked Kubernetes for a GPU, the Device Plugin gave it access, and CUDA ran real math on the physical card.

Clean up the test pod when you are done:

Bash
kubectl delete -f cuda-vectoradd.yaml

Step 10: Run a Real GPU Workload Example

For a more realistic test, deploy a Jupyter Notebook container with GPU access, so you can interactively test PyTorch or TensorFlow code:

Bash
nano tf-notebook.yaml
YAML
apiVersion: v1kind: Servicemetadata:  name: tf-notebook  labels:    app: tf-notebookspec:  type: NodePort  ports:  - port: 80    name: http    targetPort: 8888    nodePort: 30001  selector:    app: tf-notebook---apiVersion: v1kind: Podmetadata:  name: tf-notebook  labels:    app: tf-notebookspec:  securityContext:    fsGroup: 0  containers:  - name: tf-notebook    image: tensorflow/tensorflow:latest-gpu-jupyter    resources:      limits:        nvidia.com/gpu: 1    ports:    - containerPort: 8888      name: notebook

Apply it, then grab the access token from the logs:

Bash
kubectl apply -f tf-notebook.yamlkubectl logs tf-notebook

Open http://<your-server-ip>:30001 in your browser and paste in the token shown in the logs. This gives you a real GPU-backed notebook running inside your K3s cluster, ready for real AI workloads.

Common Errors When You Install NVIDIA GPU Operator on K3s

A few issues come up on bare-metal K3s nodes, so check these first if something fails:

  • Toolkit pod stuck pending or crashing: It means the CONTAINERD_CONFIG path is wrong. Double-check the K3s path exactly as shown in Step 6.
  • nvidia-smi fails inside pods but works on the host: The container runtime is not using the NVIDIA runtime class yet. Restart K3s with sudo systemctl restart k3s after installing the Operator so containerd reloads its config.
  • Driver pod crash loop: It is a Secure Boot issue. Disable Secure Boot in the BIOS or sign the kernel modules.
  • ClusterPolicy stuck in notReady: Run kubectl describe clusterpolicy cluster-policy to see the exact blocking component.

Note: Testing on one server is fine for learning, but real AI workloads need strong GPU hardware, fast storage, and stable network. If you don't want to build your own GPU server, you can also try PerLod's AI hosting plans for fully managed AI infrastructure.

Conclusion

At this point, you know how to install NVIDIA GPU Operator 26.7 on K3s, starting from a clean Ubuntu server to a fully working and monitored GPU cluster. From here, you can add more GPU nodes, split GPUs between workloads with MIG, or connect Prometheus and Grafana to DCGM Exporter for full monitoring. 

We hope you enjoy this guide. For more detailed information, you can check the NVIDIA GPU Operator Official Documentation.

Yes. You just need to point the container toolkit to the K3s-specific containerd config and socket paths, as shown in Step 6.

Yes. The Device Plugin registers all GPUs found on the node as separate nvidia.com/gpu resources automatically.

No, the Operator can install it in a container automatically. Manual host installation is optional, but it is more stable for production bare-metal servers.