Running Distributed AI Training & Inference (vLLM, Ray / KubeRay) on K8s
Run distributed training and high-throughput inference with vLLM and KubeRay.
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/modelsand 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
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.
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.
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.
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.
How it works, step by step
Step 1 of 41. 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.
- 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/modelsin 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/modelsfirst: 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
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.
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.
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/modelswithout 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?
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
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.