GPU Scheduling in Kubernetes: What Works in Production

GPU Scheduling in Kubernetes: What Works in Production

What happens when three teams all want the same A100 at nine in the morning? On a plain Kubernetes cluster, somebody’s training job waits in a queue, somebody else’s notebook grabs the card first, and nobody can explain why. That small morning headache is the whole reason GPU scheduling in Kubernetes has become its own discipline.

The core problem is simple: Kubernetes was built to schedule CPUs and memory, not accelerators. GPUs arrived later, bolted on through a framework that treats them as countable objects. That design works, but it has sharp edges. This article walks through how GPU scheduling actually functions under the hood, where it breaks down, and which tools people reach for when the built-in approach stops being enough.

How GPUs Get Advertised to the Scheduler

Kubernetes does not know what a GPU is. It learns about one through a device plugin, a small agent that runs on each node, talks to the kubelet, and announces hardware the cluster can hand out. The device plugin framework landed as an alpha feature in Kubernetes 1.8 and reached general availability in 1.10. Vendors ship their own plugins; NVIDIA’s is the one most clusters end up running.

Once a plugin is registered, the GPU shows up as an extended resource. A pod asks for it in its resource limits, something like `nvidia.com/gpu: 1`. The scheduler then matches pods to nodes the same way it matches CPU requests, with a few important differences:

  • Extended resources must be whole integers. You cannot request half a GPU this way.

  • They are never overcommitted. If a node advertises four GPUs, four is the hard ceiling.

  • They do not participate in the usual CPU and memory quality-of-service accounting.

The official documentation on how extended resources are requested and accounted for explains those rules in detail, and they matter more than they look. That integer-only, no-overcommit rule is exactly why GPU sharing became such a headache.

Why the Default Scheduler Is Blind to GPU Details

Why the Default Scheduler Is Blind to GPU Details

Here is the uncomfortable truth about the built-in scheduler: it sees a GPU as a number. It does not know whether that number refers to an A100 with 80 GB or a T4 with 16 GB. It does not know which GPUs sit on the same NVLink bridge. It does not know whether a card is already partitioned into smaller slices.

In practice, this produces a few classic failure modes:

The wrong-model problem. A cluster with mixed GPU types advertises all of them under the same resource name. A pod that needs 80 GB of memory lands on a 16 GB card because the scheduler had no way to tell them apart. The fix is usually to advertise distinct resource names per model, which the device plugin supports but which nobody configures until after the first outage.

The topology problem. Multi-GPU training wants cards connected by fast interconnects. The scheduler will happily spread a four-GPU pod across two nodes with a slow network link between them, because it has no concept of where those GPUs physically sit.

The fragmentation problem. Small requests nibble away at big nodes until no single node has enough free GPUs for a large job, even though the cluster has plenty of capacity overall.

The Kubernetes project has acknowledged these limits. Its DRA documentation describes the intended long-term answer: structured device claims that let workloads express attributes like model, memory, and topology instead of asking for an opaque count. DRA arrived as alpha in Kubernetes 1.26 and has been moving through maturity stages since. It is the direction of travel, but plenty of production clusters still run on plain extended resources today.

The Vendor Layer: Device Plugins, Time-Slicing, and MIG

Because the core API cannot express GPU sharing, the vendor layer does it instead. NVIDIA’s device plugin and the surrounding operator stack are the most common production path, and the NVIDIA GPU Operator documentation covers deployment, time-slicing, and MIG configuration.

Two sharing mechanisms dominate:

Mechanism How it works Best for Main trade-off
Time-slicing One physical GPU is advertised N times; workloads take turns Inference, notebooks, light dev work No memory isolation; one process can starve others
MIG The GPU is physically partitioned into isolated instances Multi-tenant serving, strict isolation Fixed slice sizes; not every GPU model supports it

MIG (Multi-Instance GPU) arrived with the A100 in 2020 and slices one card into separate devices, each with its own memory and compute. To the scheduler, each slice looks like its own resource. The NVIDIA MIG user guide explains the partitioning model and its constraints. Time-slicing is cheaper and more flexible but offers no isolation at all, which is fine for a shared dev cluster and a bad idea for anything with a latency guarantee.

The practical rule most teams land on: time-slicing for interactive and low-priority work, MIG for anything multi-tenant with real service levels, and whole GPUs for large training jobs.

Gang Scheduling and Queueing for Batch Work

A single pod asking for one GPU is easy. Eight pods that must all start together is not. The default scheduler places pods one at a time, so a distributed training job can end up half-scheduled, holding GPUs hostage while it waits for the rest of its pods. That is deadlock, and it is common enough that entire projects exist to solve it.

Gang scheduling means all-or-nothing placement: either every pod in the group gets a GPU or none do. Two projects address this for Kubernetes:

  • Volcano, a CNCF project accepted as a sandbox project in 2020 and later incubating, adds batch scheduling, queues, and gang semantics aimed at AI and HPC workloads.

  • Kueue, a Kubernetes SIG Scheduling project that appeared around 2022, focuses on quota management and job queueing, letting admins cap how much GPU capacity each namespace or team can consume.

Both plug into the scheduling framework, which since Kubernetes 1.15 has exposed extension points like Filter, Score, and Reserve that let custom logic influence placement. The scheduling framework documentation lays out those hooks. This is also where GPU-aware schedulers hook in when teams need topology-aware placement the core scheduler cannot provide. (Kubernetes Documentation: Scheduling, Preemption and Eviction)

Node Labels and Hardware Discovery

One unglamorous but genuinely useful piece of the puzzle is labeling. The Node Feature Discovery project, originally from Intel and now a Kubernetes SIG Node effort, labels nodes with hardware facts, including which GPU model is present. Those labels let you write node selectors and affinity rules that keep an 80 GB job off a 16 GB card without inventing separate resource names.

It is a blunt instrument, but it is cheap, it works with the stock scheduler, and it requires no extra control plane components. For clusters with two or three GPU types, labels plus node affinity often solve the wrong-model problem entirely.

Practical Tips and Common Mistakes

A few patterns show up again and again in clusters that run smoothly, and their opposites show up in clusters that do not.

Set GPU requests equal to limits. Extended resources cannot be overcommitted, so the request and limit should match. Leaving the request unset while setting only a limit confuses people reading the manifest and can produce surprising scheduling behavior.

Do not mix GPU models under one resource name. This is the single most common misconfiguration. Give each model its own resource key, or lean on node labels, but do not pretend a T4 and an A100 are interchangeable.

Reserve capacity for system workloads. The device plugin and driver daemonsets need to run somewhere. On small clusters, a greedy training job can starve them and take the node’s GPU support down with it.

Watch for stranded GPUs. A pod holding a GPU while idle still blocks that GPU. Notebooks left running overnight are the usual culprit; namespace quotas through something like Kueue fix this faster than policy documents do.

Test MIG profiles before committing. Slice sizes are fixed at configuration time. A profile that looks generous on paper may leave no slice large enough for the workload that actually pays the bills.

Do not assume the scheduler understands your hardware. If placement decisions matter, verify them with real workloads rather than trusting that the scheduler figured it out.

Teams tracking how these patterns evolve across Kubernetes often follow release notes and operational write-ups; the news section is one place those updates surface, and the cloud coverage digs into managed Kubernetes behavior specifically. For background reading on how platform teams approach shared infrastructure, the blog archive covers related operational topics.

What Changes With DRA

DRA is the most significant shift on the horizon. Instead of asking for a count of an opaque resource, a workload files a claim describing what it needs: a certain GPU model, a minimum memory size, a topology requirement. The scheduler then matches claims to devices with full knowledge of their attributes. (Wikipedia: Graphics Processing Unit)

For teams that have spent years working around the scheduler’s blindness, this is a real change. It also means the workarounds described above, particularly separate resource names and label-based pinning, may eventually become legacy patterns. Until DRA is fully graduated and widely supported by vendor plugins, though, most clusters will keep running the extended-resource model, and the practical advice in this article still applies.

Conclusion

GPU scheduling in Kubernetes works, but it works through layers of workarounds rather than a single clean abstraction. The device plugin advertises hardware, extended resources make it requestable, and everything beyond that, from model awareness to sharing to gang scheduling, comes from the vendor layer and the projects around Kubernetes.

The teams that struggle least are the ones that accept this early. They give each GPU model a distinct identity, choose time-slicing or MIG deliberately rather than by default, add queueing before someone hogs the cluster, and keep an eye on DRA as it matures. None of that is exotic. It is just the difference between a cluster that schedules GPUs and one that schedules them well.

Frequently Asked Questions

How does Kubernetes know a node has a GPU?

A device plugin running on the node registers with the kubelet and advertises the GPU as an extended resource. The scheduler then treats that resource like any other countable item, without understanding the hardware behind it.

Can multiple pods share a single GPU?

Not through the core API. Sharing happens at the vendor level, either through time-slicing, where the GPU is advertised multiple times and workloads take turns, or through MIG, which physically partitions the card into isolated instances.

What is the difference between time-slicing and MIG?

Time-slicing lets several workloads share one GPU by switching between them, with no memory isolation. MIG divides the GPU into separate hardware partitions, each with dedicated memory, which gives real isolation but offers less flexibility in slice sizes.

Why do distributed training jobs get stuck waiting for GPUs?

The default scheduler places pods one at a time, so a multi-pod job can end up partially scheduled and deadlocked. Gang scheduling, available through projects like Volcano and Kueue, makes placement all-or-nothing so a job either gets all its GPUs or waits in a queue.

What is DRA?

It is a newer Kubernetes mechanism that lets workloads describe device requirements, such as GPU model, memory, and topology, instead of requesting an opaque count. It is intended to replace extended resources for complex hardware as it matures.

Do I need a custom scheduler for GPU workloads?

Usually not at first. Node labels, distinct resource names, and a queueing layer cover most clusters. A custom or secondary scheduler becomes worthwhile when topology-aware placement or fine-grained sharing is a hard requirement rather than a nice-to-have.

Latest articles

Scroll to Top