Skip to content
GPU infrastructure on Kubernetes · Chapter 19 of 19 Appendix B: Final exam

Appendix B: Final exam

Goal: You solve ten tasks spanning the whole book in 120 minutes, faults and assignments, each with cause and proof, and grade yourself · Duration: 120 min · Prerequisite: Days 0–15

Rules of the Game

  • Time: 120 minutes, set a timer. Each task counts 10%.
  • There is no certificate. Your own bar: from 70% on, you can run a GPU platform on Kubernetes.
  • An examiner (a colleague or you yourself, without looking) runs the preparation before each task. The task only describes the symptom or the assignment.
  • Allowed: --help, kubectl explain, the documentation of Kubernetes, Kueue, the GPU Operator, the DRA driver and Prometheus. Not allowed: this course during the exam.
  • A fault only counts with the cause in one sentence and a proof command. If you bypass Kueue, delete the teams’ jobs or switch off alerts, you get 0%.
  • All commands run on the lab VM. The solutions are at the end. Read them only after the time is up.

Preparation

Once before the first task: a working directory with the job from Day 10, a namespace for the exam and the connection to Prometheus.

mkdir -p ~/gpu/pruefung && cd ~/gpu/pruefung
cp ~/gpu/tag10/job.yaml .
kubectl create ns pruefung
kubectl -n monitoring port-forward svc/monitoring-kube-prometheus-prometheus 9090:9090 >/dev/null 2>&1 &

Expected:

namespace/pruefung created

Task 1: New Taint (10%)

Examiner:

kubectl taint node gpu-worker2 nvidia.com/gpu- >/dev/null
kubectl taint node gpu-worker2 gpu=a100:NoSchedule >/dev/null
cd ~/gpu/pruefung
sed -e "s/name: lauf-1/name: a1/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 1/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
clear

A colleague has “unified the taints on the GPU nodes”. Since then, job a1 in the namespace training stays Pending, although Kueue has admitted it. Fix it so that future jobs run as well.

Task 2: Two Ampere GPUs (10%)

Assignment, no preparation: in the namespace pruefung, create a ResourceClaim zwei-ampere that requests exactly two GPUs with the architecture Ampere, and a Pod zwei that uses it. Proof: nvidia-smi -L in the Pod shows two GPUs, the claim names two devices.

Task 3: Preempted (10%)

Examiner:

cd ~/gpu/pruefung
kubectl patch clusterqueue inferenz --type json -p '[{"op":"replace","path":"/spec/resourceGroups/0/flavors/0/resources/2/nominalQuota","value":"0"}]' >/dev/null
sed -e "s/name: lauf-1/name: a3/" -e "s/namespace: training/namespace: inferenz/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 1/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
sleep 15
sed -e "s/name: lauf-1/name: gross/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 4/" -e "s/sleep 600/sleep 300/" job.yaml | sed "s/cpu: 500m/cpu: 100m/" | kubectl apply -f - >/dev/null
sed -e "s/name: lauf-1/name: zwei/" -e "s/namespace: training/namespace: forschung/" -e "s/sleep 600/sleep 300/" job.yaml | sed "s/cpu: 500m/cpu: 100m/" | kubectl apply -f - >/dev/null
clear

Team inferenz complains: job a3 was running, was then stopped, and has been waiting ever since whenever the other teams are working. “But we are entitled to two GPUs.” Find the reason and fix it.

Task 4: A New Team (10%)

Assignment, no preparation: the team team-neu (namespace of the same name, does not exist yet) should be able to submit GPU jobs through Kueue and share the quota of training. Proof: a job with the label kueue.x-k8s.io/queue-name: gpu in team-neu gets admitted and runs.

Task 5: New Queue, No Jobs (10%)

Examiner:

kubectl -n forschung delete localqueue gpu >/dev/null
kubectl apply -f - >/dev/null <<'EOF'
apiVersion: kueue.x-k8s.io/v1beta2
kind: LocalQueue
metadata:
  name: gpu
  namespace: forschung
spec:
  clusterQueue: forscher
EOF
cd ~/gpu/pruefung
sed -e "s/name: lauf-1/name: a5/" -e "s/namespace: training/namespace: forschung/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 1/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
clear

After a “clean-up of the queues”, nothing starts in the namespace forschung anymore, job a5 stays Suspended. The other teams notice nothing.

Task 6: Eight Devices, No Allocation (10%)

Examiner:

kubectl patch deviceclass gpu.nvidia.com --type json -p '[{"op":"replace","path":"/spec/selectors/0/cel/expression","value":"device.driver == '"'"'gpu.nvidia.com'"'"' && device.attributes['"'"'gpu.nvidia.com'"'"'].type == '"'"'gpu'"'"' && device.attributes['"'"'gpu.nvidia.com'"'"'].architecture == '"'"'Hopper'"'"'"}]' >/dev/null
cd ~/gpu/pruefung
sed -e "s/name: lauf-1/name: a6/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 1/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
clear

Job a6 in training stays Pending. The DRA driver is running, kubectl get resourceslice shows all eight GPUs. Running Pods with GPUs are not affected.

Task 7: A Warning Alert (10%)

Assignment, no preparation: create a PrometheusRule gpu-warm in the namespace monitoring. The alert GPUWarm with severity: warnung should fire when a GPU is warmer than 30 degrees for longer than one minute, and name the GPU, node and temperature in the summary. Proof: the alert fires for all eight GPUs (Mokka reports 33 degrees). Afterwards, delete the rule again.

Task 8: The Slow Model (10%)

Examiner (takes about a minute, the Ollama image from Day 14 is still in the cache):

sed -e "s/namespace: tag14/namespace: pruefung/" -e "s/memory: 3Gi/memory: 600Mi/" -e "s/memory: 2Gi/memory: 500Mi/" ~/gpu/tag14/ollama.yaml | kubectl apply -f - >/dev/null
kubectl -n pruefung rollout status deploy/modell --timeout=300s >/dev/null
kubectl -n pruefung exec deploy/modell -- ollama pull qwen2.5:0.5b >/dev/null 2>&1
kubectl -n pruefung run frage --image=curlimages/curl:8.17.0 --restart=Never --command -- sleep 3600 >/dev/null
kubectl -n pruefung wait --for=condition=Ready pod/frage --timeout=120s >/dev/null
clear

The model service modell in pruefung responds, but painfully slowly. Measurement:

kubectl -n pruefung exec frage -- curl -s -m 120 http://modell:11434/api/generate -d '{"model":"qwen2.5:0.5b","prompt":"Erkläre in zwei Sätzen, was eine GPU ist.","stream":false,"options":{"seed":1,"temperature":0}}' > antwort.json
jq -r '"load \(.load_duration/1e9|.*100|floor/100) s, \(.eval_count) Token in \(.eval_duration/1e9|.*100|floor/100) s = \(.eval_count/(.eval_duration/1e9)*10|floor/10) Token/s"' antwort.json

Expected (similar for you):

load 4.51 s, 148 Token in 64.18 s = 2.3 Token/s

On Day 14 it was around 20 tokens per second. Bring the service back there.

Task 9: Urgent (10%)

Examiner:

cd ~/gpu/pruefung
for t in training training inferenz forschung; do sed -e "s/name: lauf-1/name: nebenbei-$RANDOM/" -e "s/namespace: training/namespace: $t/" -e "s/    kueue.x-k8s.io\/queue-name: gpu/    kueue.x-k8s.io\/queue-name: gpu\n    kueue.x-k8s.io\/priority-class: niedrig/" -e "s/sleep 600/sleep 1800/" job.yaml | sed "s/cpu: 500m/cpu: 100m/" | kubectl apply -f - >/dev/null; done
sleep 15
sed -e "s/name: lauf-1/name: dringend/" -e "s/    kueue.x-k8s.io\/queue-name: gpu/    kueue.x-k8s.io\/queue-name: gpu\n    kueue.x-k8s.io\/priority-class: Hoch/" -e "s/sleep 600/sleep 300/" job.yaml | sed "s/cpu: 500m/cpu: 100m/" | kubectl apply -f - >/dev/null
clear

All eight GPUs are occupied by experiments with priority niedrig. Team training has submitted the production run dringend with high priority, but it stays Suspended. It has to start without you deleting any jobs.

Task 10: Who Has the GPUs? (10%)

Examiner:

cd ~/gpu/pruefung
kubectl apply -f - >/dev/null <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nebenher
  namespace: default
spec:
  replicas: 3
  selector:
    matchLabels: {app: nebenher}
  template:
    metadata:
      labels: {app: nebenher}
    spec:
      tolerations:
      - key: nvidia.com/gpu
        operator: Exists
        effect: NoSchedule
      containers:
      - name: app
        image: ubuntu:24.04
        command: ["sleep", "infinity"]
        resources:
          limits:
            nvidia.com/gpu: 2
EOF
sleep 20
sed -e "s/name: lauf-1/name: a10/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
sed -e "s/name: lauf-1/name: a10/" -e "s/namespace: training/namespace: inferenz/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f - >/dev/null
clear

Training and inferenz have each submitted a job with two GPUs. Kueue has admitted both, the ClusterQueues show enough free quota. The job in training runs, the one in inferenz stays Pending. Find out why, and provide a permanent remedy (describing the measure is enough).

Solutions

Solution 1

kubectl -n training describe pod -l job-name=a1 | grep FailedScheduling | sed 's/.*default-scheduler  //'
kubectl get node gpu-worker2 -o jsonpath='{.spec.taints}{"\n"}'
kubectl -n training get pod -l job-name=a1 -o jsonpath='{.items[0].spec.tolerations}{"\n"}' | cut -c1-200

Expected:

0/3 nodes are available: 1 node(s) didn't match Pod's node affinity/selector, 2 node(s) had untolerated taint(s). preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
[{"effect":"NoSchedule","key":"gpu","value":"a100"}]
[{"effect":"NoSchedule","key":"nvidia.com/gpu","operator":"Exists"},{"effect":"NoExecute","key":"node.kubernetes.io/not-ready","operator":"Exists","tolerationSeconds":300},{"effect":"NoExecute","key":

Cause: The node now carries the taint gpu=a100, but the ResourceFlavor a100 only gives the jobs a toleration for nvidia.com/gpu (Days 4 and 10). The right fix is to restore the taint: the DaemonSets of the GPU Operator, Mokka and the DRA driver are also set up for nvidia.com/gpu. If you only change the flavor instead, you fix the jobs, but a newly starting operand then no longer fits on the node.

kubectl taint node gpu-worker2 gpu-
kubectl taint node gpu-worker2 nvidia.com/gpu=present:NoSchedule
sleep 15
kubectl -n training get pods -l job-name=a1
kubectl -n training delete job a1

Expected:

node/gpu-worker2 untainted
node/gpu-worker2 tainted
NAME       READY   STATUS    RESTARTS   AGE
a1-cvj9n   1/1     Running   0          32s
job.batch "a1" deleted from training namespace

Solution 2

cd ~/gpu/pruefung
cat > claim-zwei.yaml <<'EOF'
apiVersion: resource.k8s.io/v1
kind: ResourceClaim
metadata:
  name: zwei-ampere
  namespace: pruefung
spec:
  devices:
    requests:
    - name: gpus
      exactly:
        deviceClassName: gpu.nvidia.com
        allocationMode: ExactCount
        count: 2
        selectors:
        - cel:
            expression: device.attributes["gpu.nvidia.com"].architecture == "Ampere"
EOF
kubectl apply -f claim-zwei.yaml
sed -e "s/namespace: tag08/namespace: pruefung/" -e "s/name: job-2/name: zwei/" -e "s/resourceClaimName: gpus-2/resourceClaimName: zwei-ampere/" ~/gpu/tag08/pod-2.yaml | kubectl apply -f -
kubectl -n pruefung wait --for=condition=Ready pod/zwei --timeout=90s
kubectl -n pruefung exec zwei -- nvidia-smi -L
kubectl -n pruefung get resourceclaim zwei-ampere -o jsonpath='{range .status.allocation.devices.results[*]}{.device} {end}{"\n"}'

Expected:

resourceclaim.resource.k8s.io/zwei-ampere created
pod/zwei created
pod/zwei condition met
GPU 0: NVIDIA A100-SXM4-40GB (UUID: GPU-12345678-1234-1234-1234-123456780004)
GPU 1: NVIDIA A100-SXM4-40GB (UUID: GPU-12345678-1234-1234-1234-123456780005)
gpu-4 gpu-5 

allocationMode: ExactCount with count: 2 from Day 8, the CEL selector from Day 9. The Pod uses the template pod-2.yaml from Day 8. Clean-up: kubectl -n pruefung delete pod zwei and kubectl -n pruefung delete resourceclaim zwei-ampere.

Solution 3

kubectl get workloads -A
W=$(kubectl -n inferenz get workload -o name | grep a3)
kubectl -n inferenz get $W -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'
kubectl get clusterqueue inferenz -o jsonpath='{.spec.resourceGroups[0].flavors[0].resources[2]}{"\n"}'

Expected:

NAMESPACE   NAME              QUEUE   RESERVED IN   ADMITTED   FINISHED   AGE
forschung   job-zwei-465e1    gpu     forschung     True                  20s
inferenz    job-a3-20f65      gpu                   False                 44s
training    job-gross-aa536   gpu     training      True                  21s
QuotaReserved=False WaitingForQuota: couldn't assign flavors to pod set main: insufficient unused quota for nvidia.com/gpu in flavor a100, 1 more needed
Evicted=True Preempted: Preempted to accommodate a workload (UID: ccb20fa7-1772-434a-8c0e-6a3b4fdbe375, JobUID: 99a4b262-89a7-4b73-a905-b44fa21742d2) due to reclamation within the cohort; preemptor path: /gpu/forschung; preemptee path: /gpu/inferenz
Admitted=False NoReservation: The workload has no reservation
Preempted=True InCohortReclamation: Preempted to accommodate a workload (UID: ccb20fa7-1772-434a-8c0e-6a3b4fdbe375, JobUID: 99a4b262-89a7-4b73-a905-b44fa21742d2) due to reclamation within the cohort; preemptor path: /gpu/forschung; preemptee path: /gpu/inferenz
Requeued=True Preempted: Preempted to accommodate a workload (UID: ccb20fa7-1772-434a-8c0e-6a3b4fdbe375, JobUID: 99a4b262-89a7-4b73-a905-b44fa21742d2) due to reclamation within the cohort; preemptor path: /gpu/forschung; preemptee path: /gpu/inferenz
PodsReady=False WaitForStart: Not all pods are ready or succeeded
{"name":"nvidia.com/gpu","nominalQuota":"0"}

Cause: The GPU quota of inferenz is set to 0. As long as the cohort has room, inferenz borrows the GPU (Day 11), which is why a3 ran at first. As soon as forschung wants its own GPUs back, Kueue preempts the borrowed job (reclamation within the cohort). A quota of 0 goes unnoticed in everyday operation, only under load.

kubectl patch clusterqueue inferenz --type json -p '[{"op":"replace","path":"/spec/resourceGroups/0/flavors/0/resources/2/nominalQuota","value":"2"}]'
sleep 15
kubectl get workloads -A
kubectl -n training delete job gross; kubectl -n forschung delete job zwei; kubectl -n inferenz delete job a3

Expected:

clusterqueue.kueue.x-k8s.io/inferenz patched
NAMESPACE   NAME              QUEUE   RESERVED IN   ADMITTED   FINISHED   AGE
forschung   job-zwei-465e1    gpu     forschung     True                  43s
inferenz    job-a3-20f65      gpu     inferenz      True                  67s
training    job-gross-aa536   gpu     training      True                  44s
job.batch "gross" deleted from training namespace
job.batch "zwei" deleted from forschung namespace
job.batch "a3" deleted from inferenz namespace

Solution 4

cd ~/gpu/pruefung
kubectl create ns team-neu
cat > lq-neu.yaml <<'EOF'
apiVersion: kueue.x-k8s.io/v1beta2
kind: LocalQueue
metadata:
  name: gpu
  namespace: team-neu
spec:
  clusterQueue: training
EOF
kubectl apply -f lq-neu.yaml
sed -e "s/name: lauf-1/name: erster/" -e "s/namespace: training/namespace: team-neu/" -e "s/nvidia.com\/gpu: 2/nvidia.com\/gpu: 1/" -e "s/sleep 600/sleep 60/" job.yaml | kubectl apply -f -
sleep 15
kubectl -n team-neu get workloads
kubectl get localqueue -A

Expected:

namespace/team-neu created
localqueue.kueue.x-k8s.io/gpu created
job.batch/erster created
NAME               QUEUE   RESERVED IN   ADMITTED   FINISHED   AGE
job-erster-3180e   gpu     training      True                  15s
NAMESPACE   NAME   CLUSTERQUEUE   PENDING WORKLOADS   ADMITTED WORKLOADS
forschung   gpu    forschung      0                   0
inferenz    gpu    inferenz       0                   0
team-neu    gpu    training       0                   1
training    gpu    training       0                   0

One LocalQueue is enough, because the ClusterQueue training has namespaceSelector: {} and accepts any namespace. If you want to separate teams, you set a selector on a namespace label there. Clean-up: kubectl delete ns team-neu.

Solution 5

W=$(kubectl -n forschung get workload -o name | grep a5)
kubectl -n forschung get $W -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'
kubectl get localqueue -n forschung
kubectl -n forschung get localqueue gpu -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}'

Expected:

QuotaReserved=False Misconfigured: ClusterQueue forscher doesn't exist
Admitted=False NoReservation: The workload has no reservation
PodsReady=False WaitForStart: Not all pods are ready or succeeded
NAME   CLUSTERQUEUE   PENDING WORKLOADS   ADMITTED WORKLOADS
gpu    forscher       1                   0
Active=False ClusterQueueDoesNotExist: Can't submit new workloads to clusterQueue

Cause: The LocalQueue points to a ClusterQueue forscher that does not exist. The field spec.clusterQueue cannot be changed:

kubectl -n forschung patch localqueue gpu --type merge -p '{"spec":{"clusterQueue":"forschung"}}'

Expected:

The LocalQueue "gpu" is invalid: spec.clusterQueue: Invalid value: "forschung": field is immutable

So delete it and create it again. The waiting job is preserved:

cd ~/gpu/pruefung
kubectl -n forschung delete localqueue gpu
sed "s/namespace: team-neu/namespace: forschung/; s/clusterQueue: training/clusterQueue: forschung/" lq-neu.yaml | kubectl apply -f -
sleep 15
kubectl -n forschung get workloads
kubectl -n forschung delete job a5

Expected:

localqueue.kueue.x-k8s.io "gpu" deleted from forschung namespace
localqueue.kueue.x-k8s.io/gpu created
NAME           QUEUE   RESERVED IN   ADMITTED   FINISHED   AGE
job-a5-6f0ba   gpu     forschung     True                  37s
job.batch "a5" deleted from forschung namespace

Solution 6

kubectl -n training describe pod -l job-name=a6 | grep FailedScheduling | sed 's/.*default-scheduler  //'
echo "Geräte: $(kubectl get resourceslice -o json | jq '[.items[].spec.devices[]] | length')"
kubectl get deviceclass gpu.nvidia.com -o jsonpath='{.spec.selectors[0].cel.expression}{"\n"}'

Expected:

0/3 nodes are available: 1 cannot allocate all claims, 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint(s). preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
Geräte: 8
device.driver == 'gpu.nvidia.com' && device.attributes['gpu.nvidia.com'].type == 'gpu' && device.attributes['gpu.nvidia.com'].architecture == 'Hopper'

Cause: The DeviceClass selector now requires Hopper (H100), but the cluster only has Ampere. The same message as with the missing driver (competition, round 1), but with eight devices: the devices are there, none matches. The class selector applies to every claim, including those translated from nvidia.com/gpu (Day 9).

kubectl patch deviceclass gpu.nvidia.com --type json -p '[{"op":"replace","path":"/spec/selectors/0/cel/expression","value":"device.driver == '"'"'gpu.nvidia.com'"'"' && device.attributes['"'"'gpu.nvidia.com'"'"'].type == '"'"'gpu'"'"'"}]'
kubectl get deviceclass gpu.nvidia.com -o jsonpath='{.spec.selectors[0].cel.expression}{"\n"}'
sleep 20
kubectl -n training get pods -l job-name=a6
kubectl -n training delete job a6

Expected:

deviceclass.resource.k8s.io/gpu.nvidia.com patched
device.driver == 'gpu.nvidia.com' && device.attributes['gpu.nvidia.com'].type == 'gpu'
NAME       READY   STATUS    RESTARTS   AGE
a6-69bwp   1/1     Running   0          45s
job.batch "a6" deleted from training namespace

The quote sequence '"'"' puts a single quote into a command that is itself in single quotes. If you find that unwieldy, use kubectl edit deviceclass gpu.nvidia.com.

Solution 7

cd ~/gpu/pruefung
cat > warm.yaml <<'EOF'
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: gpu-warm
  namespace: monitoring
spec:
  groups:
  - name: gpu-warm
    rules:
    - alert: GPUWarm
      expr: DCGM_FI_DEV_GPU_TEMP > 30
      for: 1m
      labels:
        severity: warnung
      annotations:
        summary: "GPU {{ $labels.gpu }} auf {{ $labels.Hostname }} hat {{ $value }} Grad"
EOF
kubectl apply -f warm.yaml
sleep 150
curl -s localhost:9090/api/v1/alerts | jq -r '.data.alerts[] | select(.labels.alertname=="GPUWarm") | .state + " " + .annotations.summary' | head -3
curl -s localhost:9090/api/v1/alerts | jq '[.data.alerts[] | select(.labels.alertname=="GPUWarm" and .state=="firing")] | length'
kubectl delete -f warm.yaml

Expected:

prometheusrule.monitoring.coreos.com/gpu-warm created
firing GPU 7 auf gpu-worker2 hat 33 Grad
firing GPU 0 auf gpu-worker2 hat 33 Grad
firing GPU 1 auf gpu-worker2 hat 33 Grad
8
prometheusrule.monitoring.coreos.com "gpu-warm" deleted from monitoring namespace

Same structure as GPUZuHeiss from Day 12. The waiting time is made up of Prometheus loading the rule, the evaluation interval and for: 1m.

Solution 8

P=$(kubectl -n pruefung get pod -l app=modell -o name)
kubectl -n pruefung get $P -o jsonpath='{.status.containerStatuses[0].restartCount} {.status.containerStatuses[0].lastState.terminated.reason} {.status.containerStatuses[0].lastState.terminated.exitCode}{"\n"}'
kubectl -n pruefung get deploy modell -o jsonpath='{.spec.template.spec.containers[0].resources}{"\n"}'

Expected:

1 OOMKilled 137
{"limits":{"memory":"600Mi"},"requests":{"cpu":"2","memory":"500Mi"}}

Cause: A 600 Mi memory limit for a model that needs a good 1 GB including runtime and context. Unlike with 400 Mi on Day 14, Ollama does not die immediately: the kernel keeps evicting parts of the model file from the cgroup’s page cache, Ollama reads them back in, and every now and then the OOM killer strikes after all (the restart). Even kubectl exec into the container fails at times with signal: killed (possibly OOM-killed). With models, too little memory often shows up as slowness, not as a crash.

Reset the limits as on Day 14. The first repair fails because of the pitfall from the Day 14 challenge:

kubectl -n pruefung set resources deploy/modell --limits=memory=3Gi --requests=memory=2Gi,cpu=2
kubectl -n pruefung rollout status deploy/modell --timeout=300s | tail -1
kubectl -n pruefung get pods -l app=modell

Expected:

deployment.apps/modell resource requirements updated
error: timed out waiting for the condition
NAME                      READY   STATUS    RESTARTS        AGE
modell-64ddb9d7f6-x4vwm   1/1     Running   2 (8m18s ago)   12m
modell-bbdf5fc67-jxgg5    0/1     Pending   0               8m6s

Rolling update, twice 2 CPUs on a node with 4. With Recreate it works; then reload the model (new Pod, new emptyDir) and measure:

kubectl -n pruefung patch deploy modell -p '{"spec":{"strategy":{"type":"Recreate","rollingUpdate":null}}}'
kubectl -n pruefung rollout status deploy/modell --timeout=300s | tail -1
kubectl -n pruefung exec deploy/modell -- ollama pull qwen2.5:0.5b >/dev/null 2>&1
kubectl -n pruefung exec frage -- curl -s -m 120 http://modell:11434/api/generate -d '{"model":"qwen2.5:0.5b","prompt":"Erkläre in zwei Sätzen, was eine GPU ist.","stream":false,"options":{"seed":1,"temperature":0}}' > antwort.json
jq -r '"load \(.load_duration/1e9|.*100|floor/100) s, \(.eval_count) Token in \(.eval_duration/1e9|.*100|floor/100) s = \(.eval_count/(.eval_duration/1e9)*10|floor/10) Token/s"' antwort.json

Expected:

deployment.apps/modell patched
deployment "modell" successfully rolled out
load 3.23 s, 148 Token in 7.79 s = 18.9 Token/s

Full marks only with both parts: memory and update strategy. Clean-up: kubectl delete ns pruefung (at the end of the exam).

Solution 9

kubectl -n training get jobs
kubectl -n training get workloads
kubectl -n training get events --sort-by=.lastTimestamp -o custom-columns=R:.reason,OBJ:.involvedObject.name,MSG:.message | grep -i dringend | tail -3

Expected (your names will differ):

NAME             STATUS      COMPLETIONS   DURATION   AGE
dringend         Suspended   0/1                      15s
nebenbei-12406   Running     0/1           32s        32s
nebenbei-28892   Running     0/1           32s        33s
NAME                       QUEUE   RESERVED IN   ADMITTED   FINISHED   AGE
job-nebenbei-12406-0ea06   gpu     training      True                  32s
job-nebenbei-28892-52350   gpu     training      True                  33s
WorkloadPriorityClassNotFound   dringend                   WorkloadPriorityClass "Hoch" not found
WorkloadPriorityClassNotFound   dringend                   WorkloadPriorityClass "Hoch" not found
Suspended                       dringend                   Job suspended

Cause: There is no workload at all for dringend. The label requires the priority class Hoch, but what exists is hoch (Day 11), and names in Kubernetes are case-sensitive. Without a valid class, Kueue does not create a workload, and the job stays suspended. Fix the label:

kubectl -n training label job dringend kueue.x-k8s.io/priority-class=hoch --overwrite
sleep 20
kubectl -n training get jobs
kubectl -n training get events --field-selector reason=Preempted -o custom-columns=MSG:.message | tail -1 | cut -c1-200

Expected:

job.batch/dringend labeled
NAME             STATUS      COMPLETIONS   DURATION   AGE
dringend         Running     0/1           19s        43s
nebenbei-12406   Running     0/1           60s        60s
nebenbei-28892   Suspended   0/1                      61s
Preempted to accommodate a workload (UID: a6b26f99-5ce4-4943-91d4-286ee0d7e862, JobUID: 3b5148b0-a7c2-4991-bbdf-10909f6e889e) due to prioritization in the ClusterQueue; preemptor path: /gpu/training;

dringend is running, an experiment from training is back in the queue (withinClusterQueue: LowerPriority, Day 11). Clean-up:

for t in training inferenz forschung; do kubectl -n $t delete jobs --all; done

Solution 10

kubectl -n inferenz describe pod -l job-name=a10 | grep FailedScheduling | tail -1 | sed 's/.*default-scheduler  //'
kubectl get cq -o custom-columns=NAME:.metadata.name,BELEGT:.status.flavorsUsage[0].resources[2].total
kubectl get resourceclaim -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,GERAETE:.status.allocation.devices.results[*].device

Expected:

0/3 nodes are available: 1 cannot allocate all claims, 1 node(s) didn't match Pod's node affinity/selector, 1 node(s) had untolerated taint(s). preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
NAME        BELEGT
forschung   0
inferenz    2
training    2
NS         NAME                                                 GERAETE
default    nebenher-6479b86d96-48lm8-extended-resources-mrf9l   gpu-0,gpu-1
default    nebenher-6479b86d96-gltp6-extended-resources-2fxn4   gpu-6,gpu-7
default    nebenher-6479b86d96-z6b6m-extended-resources-crlgm   gpu-2,gpu-3
training   a10-clzzs-extended-resources-cjhxr                   gpu-4,gpu-5

Cause: Kueue counts 4 occupied GPUs, but 8 are actually occupied. Six of them are held by the Deployment nebenher in the namespace default, without a queue label and with its own toleration, i.e. bypassing Kueue (Day 10, Drill 5). The ResourceClaims are the honest list: every allocated GPU is there, no matter who requested it.

kubectl delete deploy nebenher
sleep 40
kubectl get pods -A -l job-name=a10
for t in training inferenz; do kubectl -n $t delete job a10; done

Expected:

deployment.apps "nebenher" deleted from default namespace
NAMESPACE   NAME        READY   STATUS      RESTARTS   AGE
inferenz    a10-d8b2p   1/1     Running     0          70s
training    a10-clzzs   0/1     Completed   0          70s
job.batch "a10" deleted from training namespace
job.batch "a10" deleted from inferenz namespace

Permanently: Deleting alone is not enough, tomorrow the next one comes along. One of two measures is part of the solution: manageJobsWithoutQueueName: true in the Kueue configuration (Kueue then also suspends jobs without a label, Deployments only if the matching integration is enabled), or an admission policy (Kyverno or ValidatingAdmissionPolicy) that rejects GPU requests without a queue label. Add to that the taint from Day 4 as the first hurdle, which was bypassed here with a custom toleration.

Clean-up

kubectl delete ns pruefung
kubectl get resourceclaim -A
kubectl get workloads -A

Expected:

namespace "pruefung" deleted
No resources found
No resources found

Evaluation

Result Assessment
90–100% You can run a GPU platform and explain to others why it is built this way.
70–80% Confident in operations. The tasks you lost show which days you should repeat.
50–60% The building blocks are in place, the interplay is not yet. Repeat the competition (Day 15) and Days 8–11.
below 50% Go through the book again from Day 7, this time with your own notes on every failure pattern.
Task Topic Day
1 Taints, toleration in the ResourceFlavor 4, 10
2 ResourceClaim, CEL selector 8, 9
3 Cohort, borrowing, reclaiming 11
4 LocalQueue, ClusterQueue 10
5 LocalQueue, workload conditions 10
6 DeviceClass selector 8, 9
7 PrometheusRule, DCGM metrics 12
8 Model memory, update strategy 14
9 WorkloadPriorityClass, preemption 11
10 Bypassing Kueue, ResourceClaims 8, 10

Passed the exam? With a free account it counts towards your belt. Sign up for free

Contents

More