Kubernetes is where a lot of teams end up once self-hosted models move past a single box. GPUs make the usual Kubernetes patterns slightly different. Here are the basics for running LLM inference on a cluster.
Step 1: Make GPUs visible to Kubernetes
Nodes need GPU drivers, a container runtime that can expose the GPU, and a device plugin that advertises GPUs to the scheduler. The NVIDIA GPU Operator bundles these:
helm repo add nvidia https://helm.ngc.nvidia.com/nvidia
helm repo update
helm install --wait gpu-operator -n gpu-operator --create-namespace nvidia/gpu-operator
Afterwards, GPU nodes report an allocatable nvidia.com/gpu resource.
Step 2: Request a GPU in your pod
GPUs are requested through resource limits, as whole units:
resources:
limits:
nvidia.com/gpu: 1
Taint GPU nodes (for example gpu=true:NoSchedule) and add a matching toleration to inference pods, so ordinary workloads don’t land on expensive hardware.
Step 3: Deploy an inference server
vLLM is a popular choice: it batches requests efficiently and exposes an OpenAI-compatible API. A minimal deployment container looks like this:
containers:
- name: vllm
image: vllm/vllm-openai:latest
args: ["--model", "Qwen/Qwen2.5-7B-Instruct", "--max-model-len", "8192"]
ports:
- containerPort: 8000
resources:
limits:
nvidia.com/gpu: 1
readinessProbe:
httpGet: { path: /health, port: 8000 }
initialDelaySeconds: 60
Pin the image tag and model revision in production. “latest” is fine for a lab, not for an SLO.
Step 4: Health checks and slow starts
Loading model weights takes time: sometimes minutes. Use a generous initialDelaySeconds or a startup probe, and cache weights on a persistent volume so every new pod doesn’t download gigabytes from the internet.
Step 5: Scaling
CPU-based autoscaling doesn’t fit inference well. Better signals are request queue depth, running sequences or time-to-first-token, exported as metrics (vLLM exposes Prometheus metrics). Remember that scaling up means adding GPU nodes too, which can take minutes: keep headroom for spikes.
Sharing GPUs
Small models can waste a large GPU. Options include NVIDIA time-slicing (simple sharing, no isolation) and MIG partitioning on supported data-centre GPUs (hardware isolation). Measure latency before and after; sharing trades throughput for cost.
How it fits the bigger picture
This is the “GPU · LLM” building from Serving an LLM API in Production, and the dashboards from LLM Observability are how you’ll know it’s healthy. If you want to try the concepts on one machine first, start with self-hosting an LLM in your home lab.
FAQ
Can I run LLM inference on Kubernetes without NVIDIA GPUs?
Yes, small models run on CPU, and other accelerators have their own device plugins. NVIDIA GPUs remain the most common path.
Why use vLLM instead of a simple model server?
Continuous batching and efficient KV-cache management let it serve many concurrent users per GPU.
Do I need Kubernetes to serve an LLM?
No. A single GPU VM is often enough to start. Kubernetes pays off when you run several models, need rolling updates or scale across many GPUs.