Day 7: The GPU Operator
Goal: Stop maintaining the device plugin, GFD, DCGM Exporter and validator one by one, and let the NVIDIA GPU Operator manage them through a ClusterPolicy · Duration: approx. 75 min · Prerequisite: Day 6
Briefing
- Until yesterday you installed every GPU component yourself and kept them in sync: device plugin, GFD, their configurations, tolerations. Day 5 showed how easily that drifts apart.
- The GPU Operator takes this over. A single resource, the ClusterPolicy, describes which components (operands) should run. The operator creates them, keeps them alive and distributes configurations.
- On real servers it also installs the driver and the Container Toolkit. Here Mokka is the driver, so these two stay off. Everything above that is the real operator v26.3.3.
ClusterPolicy ──▶ GPU Operator ──▶ Device Plugin · GFD · DCGM Exporter · Validator
▲ (per GPU node, controlled by label)
helm values
| Operand | On real servers | Here |
|---|---|---|
| Driver | builds and loads the kernel module | off, Mokka is the driver |
| Container Toolkit | sets up containerd for GPUs | off, Mokka took care of it on Day 0 |
| Device plugin, GFD | as on Days 2 and 3 | on |
| DCGM Exporter | GPU metrics for Prometheus | on (Day 12) |
| Validator | checks the whole chain | on |
| MIG Manager | partitions GPUs by label | off |
Drill 1: Clean Up Before the Operator Arrives
Two device plugins on one node would fight over
nvidia.com/gpu. So away with the home-built ones from Days
2 and 3. NFD stays; it already runs with the right toleration.
mkdir -p ~/gpu/tag07 && cd ~/gpu/tag07
helm -n gpu-feature-discovery uninstall gfd
kubectl delete -f ~/gpu/tag02/device-plugin-mock.yaml
sleep 10
kubectl get node gpu-worker2 -o jsonpath='{.status.allocatable.nvidia\.com/gpu}{"\n"}'Expected:
release "gfd" uninstalled
daemonset.apps "nvidia-device-plugin-mock" deleted from kube-system namespace
0
Save your progress? Sign up for free
Drill 2: The Values
NVIDIA maintains a tested values file for Mokka. One entry is added, because NFD is already running:
curl -s -o gpu-operator-values.yaml https://raw.githubusercontent.com/NVIDIA/k8s-test-infra/\
v0.7.0/docs/guides/with-gpu-operator/gpu-operator-values.yaml
printf 'nfd:\n enabled: false\n' >> gpu-operator-values.yaml
grep -vE '^\s*#|^\s*$' gpu-operator-values.yaml | head -24Expected (shortened):
driver:
enabled: false
toolkit:
enabled: false
dcgm:
enabled: false
dcgmExporter:
enabled: true
env:
- name: DCGM_EXPORTER_COLLECT_INTERVAL
value: "5000"
mig:
strategy: none
migManager:
enabled: false
nodeStatusExporter:
enabled: false
cdi:
enabled: true
default: true
devicePlugin:
enabled: true
config:
name: ""
gfd:
enabled: true
Further down come environment variables for GFD and the validator.
They are the most important lesson from the Mokka project: one
values file, never --set. Nested env
lists do not survive the command line, and zsh expands
env[0] as a glob pattern before Helm sees it.
Save your progress? Sign up for free
Drill 3: Install
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
time helm install gpu-operator nvidia/gpu-operator --namespace gpu-operator \
--create-namespace --version v26.3.3 -f gpu-operator-values.yaml --wait --timeout 900sExpected (shortened, a good two minutes in the lab):
NAME: gpu-operator
NAMESPACE: gpu-operator
STATUS: deployed
REVISION: 1
DESCRIPTION: Install complete
The version is pinned deliberately: v26.3.3 is the version Mokka is tested against. Newer versions exist (v26.7.x); they may bring new hardware checks.
kubectl -n gpu-operator get ds
kubectl get node gpu-worker2 -o jsonpath='{.status.allocatable.nvidia\.com/gpu}{"\n"}'
kubectl get clusterpolicyExpected:
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
gpu-feature-discovery 1 1 1 1 1 nvidia.com/gpu.deploy.gpu-feature-discovery=true 29m
nvidia-dcgm-exporter 1 1 1 1 1 nvidia.com/gpu.deploy.dcgm-exporter=true 29m
nvidia-device-plugin-daemonset 1 1 1 1 1 nvidia.com/gpu.deploy.device-plugin=true 29m
nvidia-device-plugin-mps-control-daemon 0 0 0 0 0 nvidia.com/gpu.deploy.device-plugin=true,nvidia.com/mps.capable=true 29m
nvidia-operator-validator 1 1 1 1 1 nvidia.com/gpu.deploy.operator-validator=true 29m
8
NAME STATUS AGE
cluster-policy ready 2026-11-22T13:34:40Z
8 GPUs again, now from the operator. The MPS daemon stays at 0: it
only runs on nodes with nvidia.com/mps.capable=true, and
that is not set here.
Save your progress? Sign up for free
Drill 4: Who Runs Where, and Why
Each operand has its own nodeSelector on a label
nvidia.com/gpu.deploy.<name>. The operator sets these
labels itself on every GPU node:
kubectl get node gpu-worker2 -o json | jq -r '.metadata.labels | to_entries[]
| select(.key|startswith("nvidia.com/gpu.deploy")) | "\(.key)=\(.value)"'Expected:
nvidia.com/gpu.deploy.container-toolkit=true
nvidia.com/gpu.deploy.dcgm=true
nvidia.com/gpu.deploy.dcgm-exporter=true
nvidia.com/gpu.deploy.device-plugin=true
nvidia.com/gpu.deploy.driver=true
nvidia.com/gpu.deploy.gpu-feature-discovery=true
nvidia.com/gpu.deploy.mig-manager=true
nvidia.com/gpu.deploy.node-status-exporter=true
nvidia.com/gpu.deploy.operator-validator=true
deploy.driver=true, even though no driver is installed?
The labels say “this node would be eligible for the operand”, not “it
runs there”. A disabled operand has no DaemonSet that would read this
label. With nvidia.com/gpu.deploy.<name>=false you
exclude a single node specifically, for example for maintenance.
The images reveal the versions:
kubectl -n gpu-operator get pods -o custom-columns=NAME:.metadata.name,IMAGE:.spec.containers[0].image \
--no-headers | cut -c1-100Expected:
gpu-feature-discovery-vn8wz nvcr.io/nvidia/k8s-device-plugin:v0.19.3
gpu-operator-77cd8ff5c6-lpllg nvcr.io/nvidia/gpu-operator:v26.3.3
nvidia-dcgm-exporter-vmcxf nvcr.io/nvidia/k8s/dcgm-exporter:4.5.3-4.8.2-distroless
nvidia-device-plugin-daemonset-8x2lz nvcr.io/nvidia/k8s-device-plugin:v0.19.3
nvidia-operator-validator-ppzbw nvcr.io/nvidia/gpu-operator:v26.3.3
The operator ships device plugin v0.19.3, not v0.18.2 like our home-built one. It takes that off your hands too: versions that match each other.
Save your progress? Sign up for free
Drill 5: The Validator
The validator checks the chain in stages, each as an init container:
P=$(kubectl -n gpu-operator get pod -l app=nvidia-operator-validator -o name)
kubectl -n gpu-operator get $P -o json | jq -r '.status.initContainerStatuses[]
| "\(.name) \(.state | keys[0]) \(.state.terminated.reason // "")"'Expected:
driver-validation terminated Completed
toolkit-validation terminated Completed
cuda-validation terminated Completed
plugin-validation terminated Completed
Driver reachable, toolkit set up, CUDA (here without a real kernel,
WITH_WORKLOAD=false in the values), device plugin reports
GPUs. If a stage hangs, you know immediately where the chain breaks. On
a real server this is the first place you look after a driver
update.
Save your progress? Sign up for free
Drill 6: Self-Healing, and Where It Stops
kubectl -n gpu-operator delete ds nvidia-device-plugin-daemonset
date +%T
until [ "$(kubectl -n gpu-operator get ds nvidia-device-plugin-daemonset \
-o jsonpath='{.status.numberReady}' 2>/dev/null)" = "1" ]; do sleep 3; done
date +%TExpected:
daemonset.apps "nvidia-device-plugin-daemonset" deleted from gpu-operator namespace
14:05:20
14:05:27
Seven seconds, and the operator has recreated the DaemonSet. And a manual change?
kubectl -n gpu-operator set env ds/nvidia-device-plugin-daemonset -c nvidia-device-plugin \
TEST_HANDARBEIT=1
sleep 20
kubectl -n gpu-operator get ds nvidia-device-plugin-daemonset -o json \
| jq -r '.spec.template.spec.containers[0].env[]?.name' | grep -c TEST_HANDARBEIT
kubectl -n gpu-operator logs deploy/gpu-operator --since=40s | grep nvidia-device-plugin-daemonset \
| tail -1 | cut -c1-120Expected:
daemonset.apps/nvidia-device-plugin-daemonset env updated
1
{"level":"info","ts":1795356343.5393634,"logger":"controllers.ClusterPolicy","msg":"DaemonSet identical, skipping
The manual change stays. The operator only compares what it wrote itself and considers the DaemonSet “identical”. Only at the next upgrade or a change to the ClusterPolicy does it get overwritten, without warning. Changes therefore belong in the ClusterPolicy, never directly in the operands.
kubectl -n gpu-operator set env ds/nvidia-device-plugin-daemonset -c nvidia-device-plugin \
TEST_HANDARBEIT-Save your progress? Sign up for free
Drill 7: Time-Slicing via the ClusterPolicy
What needed two configurations for two components on Day 5 is now a single entry:
cat > time-slicing-config.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: time-slicing-config
namespace: gpu-operator
data:
a100-geteilt: |-
version: v1
flags:
migStrategy: none
sharing:
timeSlicing:
failRequestsGreaterThanOne: true
resources:
- name: nvidia.com/gpu
replicas: 4
EOF
kubectl apply -f time-slicing-config.yaml
kubectl patch clusterpolicy cluster-policy --type=merge \
-p '{"spec":{"devicePlugin":{"config":{"name":"time-slicing-config","default":"a100-geteilt"}}}}'
sleep 60
kubectl -n gpu-operator get pods -l app=nvidia-device-plugin-daemonset
kubectl get node gpu-worker2 -o jsonpath='{.status.allocatable.nvidia\.com/gpu} {.metadata.labels.nvidia\.com/gpu\.replicas} {.metadata.labels.nvidia\.com/gpu\.product}{"\n"}'Expected:
configmap/time-slicing-config created
clusterpolicy.nvidia.com/cluster-policy patched
NAME READY STATUS RESTARTS AGE
nvidia-device-plugin-daemonset-f7bdq 2/2 Running 0 55s
32 4 NVIDIA-A100-SXM4-40GB-SHARED
32 GPUs, and the GFD labels match right away: the operator gives the configuration to both operands. The device plugin Pod now has two containers. The second is the config-manager, which waits for changes.
Save your progress? Sign up for free
Exercise: Speed Drills
- Show which operands are active according to the ClusterPolicy. Target time: 1 min
- Show the status of the ClusterPolicy and the operator version. Target time: 1 min
- Show which configuration the device plugin is currently using. Target time: 2 min
Solution
kubectl get clusterpolicy cluster-policy -o json | jq -c '{driver: .spec.driver.enabled, toolkit: .spec.toolkit.enabled, devicePlugin: .spec.devicePlugin.enabled, gfd: .spec.gfd.enabled, dcgmExporter: .spec.dcgmExporter.enabled, migManager: .spec.migManager.enabled}'
kubectl get clusterpolicy; helm -n gpu-operator list
kubectl -n gpu-operator logs ds/nvidia-device-plugin-daemonset -c config-manager | grep "updated to config" | tail -1Expected (first line):
{"driver":false,"toolkit":false,"devicePlugin":true,"gfd":true,"dcgmExporter":true,"migManager":false}
Save your progress? Sign up for free
Checkpoint
kubectl get clusterpolicy -o jsonpath='{.items[0].status.state}{"\n"}'Expected: ready
kubectl -n gpu-operator get ds nvidia-device-plugin-daemonset gpu-feature-discoveryExpected: both with READY 1.
Challenge
One node should offer whole GPUs even though the default is
time-slicing. Change this only for gpu-worker2, without
touching the ClusterPolicy. Afterwards, set the default back to whole
GPUs.
Hint: The config-manager is waiting for a node label.
Solution
A second entry in the same ConfigMap and a label on the node:
cat >> time-slicing-config.yaml <<EOF
a100-ganz: |-
version: v1
flags:
migStrategy: none
EOF
kubectl apply -f time-slicing-config.yaml
kubectl label node gpu-worker2 nvidia.com/device-plugin.config=a100-ganz --overwrite
sleep 75
kubectl get node gpu-worker2 -o jsonpath='{.status.allocatable.nvidia\.com/gpu} {.metadata.labels.nvidia\.com/gpu\.replicas} {.metadata.labels.nvidia\.com/gpu\.product}{"\n"}'
kubectl -n gpu-operator logs ds/nvidia-device-plugin-daemonset -c config-manager --tail=4 \
| cut -c1-100Expected:
configmap/time-slicing-config configured
node/gpu-worker2 labeled
8 1 NVIDIA-A100-SXM4-40GB
I1122 14:07:27.433252 143 main.go:320] Successfully updated to config: a100-ganz
I1122 14:07:27.433274 143 main.go:324] Sending signal 'hangup' to 'nvidia-device-plugin'
I1122 14:07:27.434021 143 main.go:329] Successfully sent signal
I1122 14:07:27.434070 143 main.go:247] Waiting for change to 'nvidia.com/device-plugin.config' l
The config-manager reads the label, writes the new configuration and
sends the device plugin a SIGHUP. No Pod restart. This way
every node pool gets its own partitioning. Back to whole GPUs as the
default:
kubectl label node gpu-worker2 nvidia.com/device-plugin.config-
kubectl patch clusterpolicy cluster-policy --type=merge \
-p '{"spec":{"devicePlugin":{"config":{"name":"time-slicing-config","default":"a100-ganz"}}}}'
sleep 75
kubectl get node gpu-worker2 -o jsonpath='{.status.allocatable.nvidia\.com/gpu} {.metadata.labels.nvidia\.com/gpu\.replicas}{"\n"}'Expected:
node/gpu-worker2 unlabeled
clusterpolicy.nvidia.com/cluster-policy patched
8 1
Save your progress? Sign up for free
Clean-up
Done in the challenge. The operator stays installed for the following days.
Interview Note
- What does the GPU Operator do? It installs and manages all the components a Kubernetes node needs for NVIDIA GPUs, from the driver to the metrics exporter, controlled through a ClusterPolicy.
- Why not change operands directly? Because the operator overwrites the change at the next reconciliation, and not immediately but at some point. The state belongs in the ClusterPolicy.
- How do different nodes get different GPU
configurations? Several entries in the configuration ConfigMap
and the node label
nvidia.com/device-plugin.config.
Enterprise Note
- On real servers the driver operand is the trickiest part: a driver
update restarts the driver Pods and with them all GPU workloads on the
node. The operator does this via
driver.upgradePolicynode by node, with a drain. - The ClusterPolicy belongs in the Git repository (Helm values via
Argo CD or Flux). A change via
kubectl patchas today is fine in the lab; in production it is drift. - The validator is the best alert source after every change: if it
does not stay
Runningwith all stagesCompleted, the node is not ready for GPU workloads.