Kubernetes AI
How to use this book
Prerequisites and pre-work
- Want the recipes kept current?
Installing and Prerequisites
- What you need
- Choose a lab cluster
- Install
kubectl - Install Helm
- Confirm permissions
- Prepare the book namespace
- Prepare a Hugging Face token
- Check for GPU capacity
- Add the NVIDIA Helm repository
- Quick readiness test
- What not to install yet
- Try it yourself
Why Kubernetes for AI
- Three shapes of AI workload
- What makes AI workloads different
- The cloud-native AI landscape
- The running example: Mistral-7B in
ai-lab - A map of the book
- Going deeper
- Try it yourself
GPU Foundations: The NVIDIA GPU Operator
- What a node needs before
nvidia.com/gpu: 1works - Install the GPU Operator with Helm
- ClusterPolicy: one CRD to rule the stack
- GPU Feature Discovery: labels the scheduler can use
- Verify with a CUDA vector-add pod
- Driver upgrades without drama
- Going deeper
- Try it yourself
Scheduling & Sharing GPUs
- How
nvidia.com/gpuactually behaves - Steering pods to the right GPU
- Sharing one GPU
- DRA: where GPU allocation is going
- Going deeper
- Try it yourself
Serving Your First LLM with vLLM
- Why vLLM
- What fits where
- The Deployment
- Talk to your model
- When the first run fails
- Going deeper
- Try it yourself
The Model-Serving Landscape
- The contenders at a glance
- Triton: the multi-model workhorse
- TensorRT-LLM: paying for peak performance
- NIM: the packaged option
- KServe: the platform layer
- Choosing without regret
- Going deeper
- Try it yourself
Optimizing Inference: Throughput, Latency, Cost
- Continuous batching, properly understood
- Quantization: the memory lever
- Prefix caching: stop recomputing the same prompt
- Speculative decoding: the latency lever
- One base model, many fine-tunes: LoRA serving
- Autoscaling done right
- Going deeper
- Try it yourself
Distributed Inference: Beyond One GPU
- The math: when one GPU isn’t enough
- Two ways to split a model
- Single node, multiple GPUs: vLLM tensor parallelism
- Multiple nodes: LeaderWorkerSet
- The frontier: disaggregated prefill and decode
- Exhaust the simple options first
- Going deeper
- Try it yourself
Training & Batch Workloads
- The mental shift: services vs jobs
- The Kubeflow Training Operator
- Gang scheduling: all or nothing
- Kueue: quota and queueing, the Kubernetes-native way
- Checkpointing: the non-negotiable
- Going deeper
- Try it yourself
Storage & Data for AI Workloads
- Three problems, three access patterns
- Where should model weights live?
- The pattern: download once, share everywhere
- StorageClass essentials for AI
- Measure what you bought
- Shared memory: the invisible volume
- GPUDirect Storage, in one paragraph
- Going deeper
- Try it yourself
Networking for AI: RDMA, NCCL, and the East–West Fabric
- Why multi-GPU jobs are network-bound
- The fabric choices
- RDMA and GPUDirect RDMA, in plain terms
- The NVIDIA Network Operator
- NCCL: the layer that uses it all
- Validate with nccl-tests
- Going deeper
- Try it yourself
Observability & Benchmarking
- Three layers to watch
- Layer 1: GPU hardware with DCGM
- Layer 2: the serving engine
- Layer 3: SLOs and goodput
- A starter alert shortlist
- Benchmarking with genai-perf
- Going deeper
- Try it yourself
Security, Multi-Tenancy & Cost Control
- The multi-tenant GPU problem
- Baseline: quotas and limits per namespace
- Priorities: inference beats batch
- Network isolation: default deny for model namespaces
- Policy guardrails with Kyverno
- Cost: idle GPUs are the fire
- Going deeper
- Try it yourself
Emerging Patterns & Next Steps
- RAG on Kubernetes
- Vector databases on Kubernetes
- Agentic workloads
- The Gateway API Inference Extension
- Where the platform is heading
- How to keep learning
- Going deeper
- Try it yourself
Appendix A: GPU Troubleshooting Field Guide
- Symptom: Pod stuck Pending with “Insufficient nvidia.com/gpu”
- Symptom: CUDA out of memory
- Symptom: CrashLoopBackOff with a driver/library mismatch
- Symptom: Device plugin not advertising GPUs
- Symptom: NCCL hangs or timeouts in distributed jobs
- Symptom: ImagePullBackOff on huge AI images
- Quick index
Appendix B: Knowledge Quiz
- Chapters 1–2 — Foundations & the GPU Operator
- Chapter 3 — Scheduling & Sharing GPUs
- Chapters 4–6 — Serving & Optimizing LLMs
- Chapter 7 — Distributed Inference
- Chapter 8 — Training & Batch Workloads
- Chapters 9–10 — Storage & Networking for AI
- Chapter 11 — Observability & Benchmarking
- Chapter 12 — Security, Multi-Tenancy & Cost
- Chapter 13 — Emerging Patterns
- Answer key