Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 39/ 160
02. Workload Controllers & Scaling

Lifecycle Management of AI/ML & GPU Workloads on Kubernetes

Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely.

AdvancedGPU · AI/ML · Device Plugin3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

A GPU Pod is a large production studio booking; the device plugin hands over the stage and the scheduler must avoid losing setup time. The simple Kubernetes rule is: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Think of it like…

A GPU Pod is a large production studio booking; the device plugin hands over the stage and the scheduler must avoid losing setup time.

Where you’ve seen it

During a release or scale event, the workload owner runs kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'. Expected evidence: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches. If the run instead shows this symptom, stop and restore the last known state: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.

Words you’ll hear

GPU
For this lesson, GPU is the controlling idea: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
AI/ML
AI/ML is the checkpoint; run kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' and inspect the owner chain. Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.
Device Plugin
Device Plugin is the outcome to preserve; the cost is explicit: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.
Verification evidence
The evidence command is kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'. It connects the declaration to this behavior: Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely.

Visual diagram

Loading interactive diagram

Theory & deep dive

How GPU reaches the intended state

Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely. GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

The concrete checkpoint is kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'; compare the GPU owner, AI/ML state, and Device Plugin outcome instead of treating YAML acceptance as proof.

Verify AI/ML, not only object creation

Run kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' after the change and correlate the result with Events and the owning object. GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Key takeaway: GPU is implemented only when this invariant remains observable: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

AI/ML: failure boundary and production cost

Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator. The prerequisite contract is concrete: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods. A safe design limits blast radius, records the last good configuration, and uses kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' as a deterministic rollback checkpoint.

Recover from AI/ML drift

Capture the current state with kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu', then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.

Key takeaway: Accept the trade-off consciously: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

How it works, step by step

Step 1 of 4
Workload author

1. Declare workload intent

Write the controller-owned Pod or scaling intent and preserve the owner chain: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

GPU contract → owned state
Key numbers at this step
Goal
Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely.
Owner
GPU

When to use it & trade-offs

What it is

Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely. GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Why it matters: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator. The invariant at risk is specific: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches. The quickest fact check before changing the design is kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'.

When to reach for it

  • Use GPU to enforce this invariant: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
  • Use AI/ML evidence from kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' in reviews and incident timelines. Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely.
  • Choose the progressive-delivery layer route only when this cost is justified by governance or scale: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

When to avoid or be careful

  • Avoid assuming GPU is complete after YAML submission; the required behavior is concrete: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
  • Avoid treating the next symptom as random; check the owner and state with kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' first: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.
  • Avoid adopting a heavier platform wrapper before measuring its cost: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

Native, manual, and managed paths for GPU

Controller-managed workload
Best for: Schedule GPUs, manage model serving lifecycles, and isolate AI workloads safely. A concrete incident check is kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'.

Strengths: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Watch out: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods. Recovery must also recognize this signal: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.

Hand-managed Pods
Best for: Quickly testing the AI/ML assumption with kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'; the expected invariant is: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Strengths: kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike GPU, it does not make this symptom self-documenting: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.

Progressive-delivery layer
Best for: Teams that need Device Plugin integrated with guardrails; the evidence path is kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu'.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.

Watch out: The added platform ownership buys value at this cost: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
  • Trace GPU to Device Plugin through AI/ML; the invariant is: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
  • Recognize the symptom: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.
  • Justify the cost: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.
  • Verify with kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' instead of only inspecting YAML.

Benchmarks & rules of thumb

1 -
whole GPU unit is commonly requested for exclusive mode
0 -
fractional GPU sharing without an explicit mechanism such as MIG or time-slicing
2 -
lifecycle dependencies to inspect: driver and device-plugin compatibility

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the GPU owner contract: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches.
  • Ignoring this telltale condition leads to unrelated changes: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator.
  • Repeating kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu' without an owner for remediation wastes retry cost. GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches?
  • Which owner object, logs, and Events would you inspect for this symptom-Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator-?
  • At what threshold would this cost become unacceptable: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods?
Interview tip: Interview sequence: state the invariant, run kubectl describe node gpu-1; kubectl get pods -o custom-columns='NAME:.metadata.name,GPU:.spec.containers[*].resources.requests.nvidia.com/gpu', name the failure, then justify the cost. Invariant: GPU workloads request device resources exposed by a vendor plugin, and model or batch lifecycles must account for node images, driver compatibility, topology, and costly warm caches. Failure: Requesting a whole GPU prevents sharing unless MIG or time-slicing is configured, and a mismatched driver can make a device plugin show healthy with no usable accelerator. Cost: GPU sharing increases utilization but MIG profiles, host memory, NVLink topology, and specialized queues make autoscaling less elastic than ordinary CPU Pods.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Lifecycle Management of AI/ML & GPU Workloads on Kubernetes with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Blue-Green & Canary Deployments with Argo Rollouts / Flagger
Next topic
Troubleshooting Workload Failures (OOMKilled, ImagePullBackOff, Evicted)