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 155/ 160
08. Cluster Administration & Managed Cloud Kubernetes

Running Distributed AI Training & Inference (vLLM, Ray / KubeRay) on K8s

Run distributed training and high-throughput inference with vLLM and KubeRay.

AdvancedvLLM · KubeRay · Distributed AI3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

vLLM is the optimized inference line, and KubeRay is the dispatch coordinator that assigns stages and workers across a factory floor. The simple Kubernetes rule is: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Think of it like…

vLLM is the optimized inference line, and KubeRay is the dispatch coordinator that assigns stages and workers across a factory floor.

Where you’ve seen it

During a controlled maintenance window, the platform operator runs kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models. Expected evidence: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving. If the run instead shows this symptom, stop and restore the last known state: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.

Words you’ll hear

vLLM
For this lesson, vLLM is the controlling idea: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
KubeRay
KubeRay is the checkpoint; run kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models and inspect the owner chain. A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.
Distributed AI
Distributed AI is the outcome to preserve; the cost is explicit: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.
Verification evidence
The evidence command is kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models. It connects the declaration to this behavior: Run distributed training and high-throughput inference with vLLM and KubeRay.

Visual diagram

Loading interactive diagram

Theory & deep dive

How vLLM reaches the intended state

Run distributed training and high-throughput inference with vLLM and KubeRay. VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

The concrete checkpoint is kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models; compare the vLLM owner, KubeRay state, and Distributed AI outcome instead of treating YAML acceptance as proof.

Verify KubeRay, not only object creation

Run kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models after the change and correlate the result with Events and the owning object. VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Key takeaway: vLLM is implemented only when this invariant remains observable: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

KubeRay: failure boundary and production cost

A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency. The prerequisite contract is concrete: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost. A safe design limits blast radius, records the last good configuration, and uses kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models as a deterministic rollback checkpoint.

Recover from KubeRay drift

Capture the current state with kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.

Key takeaway: Accept the trade-off consciously: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

How it works, step by step

Step 1 of 4
Platform planner

1. Plan the lifecycle boundary

Inventory versions, capacity, state, backups, and ownership in a reversible plan: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

vLLM contract → owned state
Key numbers at this step
Goal
Run distributed training and high-throughput inference with vLLM and KubeRay.
Owner
vLLM

When to use it & trade-offs

What it is

Run distributed training and high-throughput inference with vLLM and KubeRay. VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Why it matters: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency. The invariant at risk is specific: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving. The quickest fact check before changing the design is kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models.

When to reach for it

  • Use vLLM to enforce this invariant: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
  • Use KubeRay evidence from kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models in reviews and incident timelines. Run distributed training and high-throughput inference with vLLM and KubeRay.
  • Choose the managed cloud or platform service route only when this cost is justified by governance or scale: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

When to avoid or be careful

  • Avoid assuming vLLM is complete after YAML submission; the required behavior is concrete: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
  • Avoid treating the next symptom as random; check the owner and state with kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models first: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

Native, manual, and managed paths for vLLM

Repeatable infrastructure control
Best for: Run distributed training and high-throughput inference with vLLM and KubeRay. A concrete incident check is kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models.

Strengths: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Watch out: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost. Recovery must also recognize this signal: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.

Manual cluster mutation
Best for: Quickly testing the KubeRay assumption with kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models; the expected invariant is: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Strengths: kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike vLLM, it does not make this symptom self-documenting: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.

Managed cloud or platform service
Best for: Teams that need Distributed AI integrated with guardrails; the evidence path is kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.

Watch out: The added platform ownership buys value at this cost: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
  • Trace vLLM to Distributed AI through KubeRay; the invariant is: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
  • Recognize the symptom: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.
  • Justify the cost: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.
  • Verify with kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models instead of only inspecting YAML.

Benchmarks & rules of thumb

1 -
Ray head commonly coordinates workers
2 -
distributed checks: accelerator topology and model readiness
0 -
inference replicas should be assumed stateless if in-memory KV caches dominate

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the vLLM owner contract: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving.
  • Ignoring this telltale condition leads to unrelated changes: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency.
  • Repeating kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models without an owner for remediation wastes retry cost. Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: vLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving?
  • Which owner object, logs, and Events would you inspect for this symptom-A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency-?
  • At what threshold would this cost become unacceptable: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost?
Interview tip: Interview sequence: state the invariant, run kubectl get raycluster,rayjob -A; kubectl get pods -l ray.io/is-ray-node=yes; curl -s http://vllm:8000/v1/models, name the failure, then justify the cost. Invariant: VLLM serves high-throughput token generation on GPU replicas or tensor-parallel groups, while KubeRay creates a Ray head and workers for distributed training or serving. Failure: A long model download can make readiness look healthy too late, a stale GPU group can strand one rank, and service load balancing across KV-cache-heavy workers causes unpredictable latency. Cost: Distributed inference uses accelerators efficiently but magnifies initialization, checkpoint consistency, network bandwidth, scheduler topology, and failure-restart cost.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Running Distributed AI Training & Inference (vLLM, Ray / KubeRay) on K8s with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
GPU Operator & Multi-Instance GPU (MIG) Slicing for AI Workloads
Next topic
Air-Gapped Kubernetes Installations & Private Registry Mirroring