Day 13: GPU Failures
Goal: GPUs fail, and they fail differently from CPUs: with Xid events, memory errors or completely. You let Mokka simulate these failures, see how the driver, DRA, exporter and alerts react, and work through the procedure for taking a node out of service, repairing it and returning it · Duration: approx. 90 min · Prerequisite: Days 8 and 12
Briefing
- The NVIDIA driver reports severe events as an Xid with a number. Some classics: 48 (double-bit error in memory), 63/64 (spare rows for defective memory), 79 (“GPU has fallen off the bus”: the GPU has disappeared from the PCIe bus), 94/95 (memory errors, contained or not).
- ECC errors are memory errors. Correctable ones happen and are absorbed. Uncorrectable ones make a program’s result worthless and are a reason to take the GPU out of service.
- Since version 0.7.0, Mokka can simulate failures:
ecc_uncorrectable(the GPU stays reachable but reports errors),lostandfallen_off_bus(the GPU no longer responds), plus an Xid number. Honestly: The failures apply to all eight GPUs at once, and they come from the simulated NVML, not from hardware. The reactions of the DRA driver, operator, exporter and Prometheus are real.
| Failure pattern | NVML/nvidia-smi |
typical reaction |
|---|---|---|
| ECC uncorrectable, Xid 79 | GPU present, error counter > 0 | alert, drain the GPU and have it checked |
| GPU lost | [GPU is lost] |
driver and components fail, take the node out of service |
Drill 1: Alerts Beforehand
If you only build alerts when the failure hits, you have them too late. Two rules for Day 13: Xid events and metrics that are missing entirely (Day 12, Challenge). Plus a Pod with a GPU that witnesses the failure:
mkdir -p ~/gpu/tag13 && cd ~/gpu/tag13
cat > ausfall-alarme.yaml <<'EOF'
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: gpu-ausfall
namespace: monitoring
spec:
groups:
- name: gpu-ausfall
rules:
- alert: GPUXidFehler
expr: DCGM_FI_DEV_XID_ERRORS > 0
labels:
severity: kritisch
annotations:
summary: "Xid {{ $value }} auf GPU {{ $labels.gpu }} ({{ $labels.Hostname }})"
- alert: GPUMesswerteFehlen
expr: absent(DCGM_FI_DEV_GPU_UTIL{Hostname="gpu-worker2"})
for: 1m
labels:
severity: kritisch
annotations:
summary: "Keine GPU-Messwerte von gpu-worker2"
EOF
kubectl apply -f ausfall-alarme.yaml
kubectl create ns tag13
sed -e 's/namespace: tag08/namespace: tag13/' ~/gpu/tag08/claim-eine.yaml | kubectl apply -f -
sed -e 's/namespace: tag08/namespace: tag13/' -e 's/name: training/name: wache/' ~/gpu/tag08/pod-eine.yaml | kubectl apply -f -
kubectl -n tag13 wait --for=condition=Ready pod/wache --timeout=60s
kubectl -n tag13 exec wache -- nvidia-smi --query-gpu=index,name,ecc.errors.uncorrected.aggregate.total,temperature.gpu --format=csvExpected:
prometheusrule.monitoring.coreos.com/gpu-ausfall created
namespace/tag13 created
resourceclaim.resource.k8s.io/eine-gpu created
pod/wache created
pod/wache condition met
index, name, ecc.errors.uncorrected.aggregate.total, temperature.gpu
0, NVIDIA A100-SXM4-40GB, 0, 33
Zero uncorrectable errors, 33 degrees. The metric
DCGM_FI_DEV_XID_ERRORS does not even exist yet: the
exporter only reports it once an Xid has occurred. The
GPUXidFehler rule waits quietly for it.
Save your progress? Sign up for free
Drill 2: An ECC Error with Xid 79
Failure injection via Helm values; --reuse-values keeps
the profile and nodeSelector from Day 0. after_calls: 1
means: the failure occurs on the first monitored NVML call. Mokka reads
the setting at startup, so the DaemonSet needs a restart:
helm upgrade nvml-mock oci://ghcr.io/nvidia/k8s-test-infra/chart/nvml-mock --version 0.7.0 -n mokka --reuse-values --set gpu.failureInjection.enabled=true --set gpu.failureInjection.mode=ecc_uncorrectable --set gpu.failureInjection.after_calls=1 --set gpu.failureInjection.xid.code=79 >/dev/null
kubectl -n mokka rollout restart ds/nvml-mock
kubectl -n mokka rollout status ds/nvml-mock --timeout=120s | tail -1
kubectl -n tag13 exec wache -- nvidia-smi --query-gpu=index,name,ecc.errors.uncorrected.aggregate.total,temperature.gpu --format=csvExpected:
daemonset.apps/nvml-mock restarted
daemon set "nvml-mock" successfully rolled out
index, name, ecc.errors.uncorrected.aggregate.total, temperature.gpu
0, NVIDIA A100-SXM4-40GB, 1, 33
The running Pod sees the error immediately: one uncorrectable error. From its point of view, the GPU keeps computing. That is exactly what makes it dangerous: a training run continues and may write wrong weights. What the platform notices:
kubectl -n gpu-operator get pods | grep -E 'validator|dcgm|feature'
kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length'Expected (right after Mokka restarts):
nvidia-dcgm-exporter-2dhqg 0/1 Init:0/1 0 1s
nvidia-operator-validator-lm8dt 0/1 Init:0/3 0 1s
0
The operator restarts its operands as soon as the driver root
changes, and the DRA driver republishes its devices. A minute later
everything is back: 8 devices, exporter and validator
Running. With ecc_uncorrectable, the GPUs stay
reachable; nothing disappears. After two minutes in Prometheus:
kubectl -n monitoring port-forward svc/monitoring-kube-prometheus-prometheus 9090:9090 >/dev/null 2>&1 &
sleep 120
curl -s localhost:9090/api/v1/query --data-urlencode 'query=count by (err_code, err_msg) (DCGM_FI_DEV_XID_ERRORS)' | jq -r '.data.result[] | .metric.err_code + " " + .metric.err_msg + " " + .value[1]'
curl -s localhost:9090/api/v1/alerts | jq -r '.data.alerts[] | select(.labels.alertname=="GPUXidFehler") | .state + " " + .annotations.summary' | head -3Expected:
79 GPU has fallen off the bus 8
firing Xid 79 auf GPU 0 (gpu-worker2)
firing Xid 79 auf GPU 1 (gpu-worker2)
firing Xid 79 auf GPU 2 (gpu-worker2)
Eight GPUs with Xid 79; the exporter supplies the description right
away as the err_msg label. The alert fires. In reality, an
Xid 79 would not come with a GPU that is still reachable; that is a
simplification of the simulation, which sets the failure type and the
Xid independently.
Save your progress? Sign up for free
Drill 3: The Procedure When It Happens
A GPU with uncorrectable errors gets no new work, the running work is ended in a controlled way, then it is repaired and checked. On a node with eight GPUs, a real defect usually hits one GPU; here it hits all of them. The procedure is the same:
1. Cordon, so nothing new arrives:
kubectl cordon gpu-worker2Expected: node/gpu-worker2 cordoned
2. Drain. wache is a bare Pod without a
controller, which drain only touches with
--force. For real workloads (Jobs, Deployments) this is not
necessary; they are rescheduled, and Kueue requeues Jobs:
kubectl drain gpu-worker2 --ignore-daemonsets --delete-emptydir-data --force --timeout=90s 2>&1 | grep -E 'evicting|evicted|drained'Expected:
evicting pod tag13/wache
pod/wache evicted
node/gpu-worker2 drained
3. Repair. In a data center: diagnose with
dcgmi diag, reset the GPU, check the spare rows, replace it
if in doubt. Here: make Mokka healthy again.
helm upgrade nvml-mock oci://ghcr.io/nvidia/k8s-test-infra/chart/nvml-mock --version 0.7.0 -n mokka --reuse-values --set gpu.failureInjection.enabled=false --set gpu.failureInjection.mode=healthy --set gpu.failureInjection.after_calls=0 --set gpu.failureInjection.xid.code=0 >/dev/null
kubectl -n mokka rollout restart ds/nvml-mock
kubectl -n mokka rollout status ds/nvml-mock --timeout=120s | tail -1
sleep 90Expected:
daemonset.apps/nvml-mock restarted
daemon set "nvml-mock" successfully rolled out
4. Check before the node comes back. The validator from Day 7 exists exactly for this:
P=$(kubectl -n gpu-operator get pod -l app=nvidia-operator-validator -o name)
kubectl -n gpu-operator logs $P -c nvidia-operator-validator --tail=1
kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length'Expected:
all validations are successful
8
5. Uncordon and check whether the alerts go quiet:
kubectl uncordon gpu-worker2
sleep 60
curl -s localhost:9090/api/v1/rules | jq -r '.data.groups[] | select(.name=="gpu-ausfall") | .rules[] | .name + " " + .state'Expected:
node/gpu-worker2 uncordoned
GPUXidFehler inactive
GPUMesswerteFehlen inactive
The Xid metric disappeared when the exporter restarted, and the alert is resolved. In reality, Xid counters stay until the driver restarts, and a GPU with repeated Xid 79 should not be reset but replaced.
Save your progress? Sign up for free
Exercise: Speed Drills
- Is Mokka’s failure injection currently off? Target time: 20 s
- Is
gpu-worker2cordoned? Target time: 15 s - What does the validator say? Target time: 30 s
Solution
helm -n mokka get values nvml-mock -o json | jq -c '.gpu.failureInjection'
kubectl get node gpu-worker2 -o jsonpath='{.spec.unschedulable}{"\n"}'
kubectl -n gpu-operator logs $(kubectl -n gpu-operator get pod -l app=nvidia-operator-validator -o name) -c nvidia-operator-validator --tail=1Expected:
{"after_calls":0,"enabled":false,"mode":"healthy","xid":{"code":0}}
all validations are successful
The empty line is the answer to question 2: without a cordon, the
unschedulable field does not exist.
Save your progress? Sign up for free
Challenge
The examiner makes the GPUs disappear:
sed -e 's/namespace: tag08/namespace: tag13/' -e 's/name: training/name: wache/' ~/gpu/tag08/pod-eine.yaml | kubectl apply -f -
kubectl -n tag13 wait --for=condition=Ready pod/wache --timeout=60s
helm upgrade nvml-mock oci://ghcr.io/nvidia/k8s-test-infra/chart/nvml-mock --version 0.7.0 -n mokka --reuse-values --set gpu.failureInjection.enabled=true --set gpu.failureInjection.mode=lost --set gpu.failureInjection.after_calls=1 >/dev/null
kubectl -n mokka rollout restart ds/nvml-mock >/dev/null
sleep 90
clearMonitoring raises an alert. Find out what is going on, take the node out of service following the procedure from Drill 3, bring it back, and explain why draining gets stuck this time.
Hint: Who releases a GPU when a Pod ends, and is it still running?
Solution
curl -s localhost:9090/api/v1/alerts | jq -r '.data.alerts[] | select(.labels.alertname=="GPUMesswerteFehlen") | .state + " " + .annotations.summary'
kubectl -n tag13 exec wache -- nvidia-smi --query-gpu=index,name,temperature.gpu --format=csv
kubectl -n nvidia-dra get pods
kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length'
kubectl -n nvidia-dra logs ds/dra-driver-nvidia-gpu-kubelet-plugin --tail=1 | cut -c1-200Expected:
firing Keine GPU-Messwerte von gpu-worker2
index, name, temperature.gpu
0, NVIDIA A100-SXM4-40GB, [GPU is lost]
NAME READY STATUS RESTARTS AGE
dra-driver-nvidia-gpu-kubelet-plugin-bmkd5 0/1 CrashLoopBackOff 3 (14s ago) 56s
0
Error: error creating driver: error enumerating all possible devices: error enumerating allocatable devices: error visiting devices: error visiting device: error getting info for GPU 0: error getting
The GPUs are gone: [GPU is lost] in the Pod, the DRA
driver crashes while enumerating the devices, the ResourceSlice is
empty, and the DCGM Exporter no longer delivers anything. The
GPUMesswerteFehlen alert reported it,
GPUXidFehler did not, because without an exporter there is
no Xid metric either. That is exactly why you need both kinds of rules.
Cordon and drain:
kubectl cordon gpu-worker2
kubectl drain gpu-worker2 --ignore-daemonsets --delete-emptydir-data --force --timeout=90s 2>&1 | grep -E 'evicting|drained|pending'
kubectl -n tag13 get podsExpected:
node/gpu-worker2 cordoned
evicting pod tag13/wache
There are pending nodes to be drained:
NAME READY STATUS RESTARTS AGE
wache 0/1 Terminating 0 8m39s
The Pod hangs in Terminating. When a Pod with a
ResourceClaim terminates, the kubelet calls the DRA driver so it
releases the GPU again (NodeUnprepareResources). But the
driver is not running. The Pod stays until the driver is back. A
--grace-period=0 --force would delete the Pod from the API,
but not the container on the node and not the GPU preparation: the
driver would still have to clean up in the end. So repair it:
helm upgrade nvml-mock oci://ghcr.io/nvidia/k8s-test-infra/chart/nvml-mock --version 0.7.0 -n mokka --reuse-values --set gpu.failureInjection.enabled=false --set gpu.failureInjection.mode=healthy --set gpu.failureInjection.after_calls=0 >/dev/null
kubectl -n mokka rollout restart ds/nvml-mock >/dev/null
kubectl -n mokka rollout status ds/nvml-mock --timeout=120s | tail -1
sleep 90
kubectl -n nvidia-dra get pods
kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length'
kubectl -n tag13 get pods,resourceclaimExpected:
daemon set "nvml-mock" successfully rolled out
NAME READY STATUS RESTARTS AGE
dra-driver-nvidia-gpu-kubelet-plugin-vmsz8 1/1 Running 0 85s
8
NAME STATE AGE
resourceclaim.resource.k8s.io/eine-gpu pending 10m
The driver is back, has released the GPU, and the Pod is gone. The
claim is pending again. Then check and uncordon as in Drill
3:
P=$(kubectl -n gpu-operator get pod -l app=nvidia-operator-validator -o name)
kubectl -n gpu-operator logs $P -c nvidia-operator-validator --tail=1
kubectl uncordon gpu-worker2Expected:
all validations are successful
node/gpu-worker2 uncordoned
Save your progress? Sign up for free
Checkpoint
helm -n mokka get values nvml-mock -o json | jq -r '.gpu.failureInjection.mode'
kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length'
curl -s localhost:9090/api/v1/query --data-urlencode 'query=count(DCGM_FI_DEV_GPU_UTIL)' | jq -r '.data.result[0].value[1]'Expected:
healthy
8
8
Clean-up
kubectl delete ns tag13
kill %1Expected: namespace "tag13" deleted
The alert rules stay; they belong in every cluster with GPUs.
Interview Note
- What is an Xid? An error message from the NVIDIA driver with a number, visible in the kernel log and via DCGM. 79 means: GPU no longer on the bus. 48, 94 and 95 are memory errors.
- How do you react to a GPU with uncorrectable ECC errors? Cordon, end the work in a controlled way, diagnose, repair or replace, check with the validator, and only then uncordon.
- Why does a Pod with a GPU hang in Terminating? With DRA, the driver must undo the preparation. If it is not running, the Pod waits. Repair the driver first; do not force-delete the Pod.
Enterprise Note
- On real nodes, cordoning is often done by a health-check agent: the NVIDIA device plugin marks GPUs with critical Xids as unhealthy, and projects like the GPU Health Monitor set taints or cordon the node themselves. DRA adds device taints, which let you block individual devices instead of whole nodes.
- Failure frequency is an operational metric: if you collect Xids and ECC counters per GPU over months, you can spot GPUs that will fail soon and replace them in a maintenance window instead of in the middle of a training run.
- For long training runs: checkpoints at short intervals. In large clusters, statistically, a node with eight GPUs fails somewhere every week. Without a checkpoint, the run starts over.