section: blog/gpu-workloads-on-kubernetes-scheduling-basics
GPU workloads on Kubernetes: scheduling basics for AI inference
How Kubernetes exposes GPUs, how to keep general workloads off expensive nodes, the options for sharing a GPU, and what to autoscale inference on.
To the Kubernetes scheduler, a GPU is just another countable resource — but an expensive, indivisible one. Getting scheduling right decides whether accelerators sit idle, sit behind the wrong pods, or serve traffic efficiently.
How GPUs become schedulable
Kubernetes does not know about GPUs natively. A device plugin running on each GPU node advertises them to the kubelet as an extended resource, for NVIDIA hardware nvidia.com/gpu. The NVIDIA GPU Operator packages the pieces a node needs: the driver, the container toolkit, the device plugin, GPU feature discovery labels and the DCGM metrics exporter.
apiVersion: v1
kind: Pod
metadata:
name: inference
spec:
nodeSelector:
nvidia.com/gpu.product: NVIDIA-L4 # label from GPU feature discovery
tolerations:
- key: nvidia.com/gpu
operator: Exists
effect: NoSchedule
containers:
- name: server
image: registry.example.com/inference:2.1.0
resources:
limits:
nvidia.com/gpu: 1Extended resources follow stricter rules than CPU and memory. They are requested in whole units, they cannot be overcommitted, and if you set a request it must equal the limit — which is why GPU requests are usually written as limits only.
Keep everything else off GPU nodes
Without a taint, the scheduler will happily place a log shipper or a batch job on a GPU node and strand capacity. Taint GPU node pools (for example nvidia.com/gpu=present:NoSchedule) and let only GPU workloads tolerate it. The ExtendedResourceToleration admission plugin can add the matching toleration automatically to pods that request the resource, when the taint key equals the resource name.
nvidia.com/gpu taint (the GPU workloads) are scheduled there; everything else stays on the general pool.Sharing a GPU
Small models often cannot use a whole modern GPU. The main options differ in isolation:
- Time-slicing advertises one GPU as several schedulable replicas. Simple, but there is no memory or fault isolation between tenants.
- MIG (Multi-Instance GPU) partitions supported data-centre GPUs into hardware-isolated instances with dedicated memory and compute.
- MPS (Multi-Process Service) lets processes share compute concurrently with configurable limits; isolation sits between time-slicing and MIG.
Autoscale on demand, not on GPU utilisation
GPU utilisation is a poor scaling signal for inference: a server batching requests efficiently can show high utilisation while latency is fine, or low utilisation while requests queue. Scale on what users feel — queue depth, concurrent requests or time-to-first-token — exposed by the serving runtime. vLLM, for example, exports the number of waiting requests as a Prometheus metric.
Checklist
- GPU node pools are tainted; only GPU workloads tolerate them.
- Pods select hardware explicitly via feature-discovery labels.
- A sharing strategy is chosen deliberately, with its isolation trade-offs understood.
- Inference scales on queue depth or latency, with model load time accounted for.
- DCGM metrics feed dashboards for utilisation, memory and errors per GPU.