supraj.dev

Kubernetes · Platform Engineering

Kueue: a fair queue for shared capacityThink of an airport with a fixed number of gates.

The Kubernetes scheduler places pods on nodes. It doesn't decide which team's batch job gets the GPUs next. Kueue makes that decision: by default it holds a job until quota for all its pod sets can be reserved at once, and queues in a cohort can borrow each other's spare quota.

Supraj Maripeddi · · 17 min read

Cover: three airline counters feed a central gate allocator. Two queues have allocated gates, one job waits at its counter until all the gates it needs are free.
Start hereYou run Kubernetes Jobs or training jobs, and more than one team shares the same nodes.
Leave knowingHow ClusterQueue, LocalQueue and ResourceFlavor split capacity, and what admission, borrowing and preemption actually do.
Keep in mindReserved quota is not a reserved node. Kueue decides who may start; the scheduler still decides where pods land.

Imagine this: three teams share one cluster. The ML team submits an eight-GPU training job. The finance team submits a nightly report that asks for 200 CPUs. The platform team has written quotas, and the numbers add up on paper.

At 2 a.m. the report starts first. The training Job submits after it, creates its pods, and the scheduler places what it can. Some pods run, the rest sit Pending. The job is half running, the GPUs it did get are idle between steps, and nobody can explain why the queue let it start.

Nothing in that path was broken. The Kubernetes scheduler was doing its job. There just wasn't a job queue in front of it. That's the gap Kueue fills.

Stick with that picture. Each airline has an allocation. A flight that needs two gates waits at the stand until both are free, instead of parking one plane and leaving the other circling.

01 / The gap

Why isn't the Kubernetes scheduler a job queue?

Because scheduling and admission are different questions. Kubernetes defines scheduling as "making sure that Pods are matched to Nodes so that Kubelet can run them". The scheduler "watches for newly created Pods that have no Node assigned" and finds a node for each one. [16] That's pod placement, one pod at a time.

Kueue answers a question before that: should this job be allowed to create its pods yet? Its own docs say it "manages quotas and how jobs consume them" and "decides when a job should wait, when a job should be admitted to start (as in pods can be created) and when a job should be preempted". [1]

It deliberately doesn't replace the rest of the stack. "Kueue does not replace any existing Kubernetes components." Cluster autoscaling, pod-to-node scheduling and job lifecycle stay with cluster-autoscaler, kube-scheduler and kube-controller-manager. [1]

At the airport
The ground crew parks planes at gates. A separate desk decides which flight is allowed to push back. Parking is not scheduling.
In the cluster
kube-scheduler assigns nodes to pods that already exist. Kueue holds a job back until its quota and checks are ready, so those pods don't exist yet.

02 / The shape of it

What does Kueue actually control?

Four objects do most of the work. A ResourceFlavor describes a kind of capacity. A ClusterQueue holds the quotas for those flavors. A LocalQueue is a team's front door in its own namespace. A Workload is the object Kueue creates to track one admitted unit of work. The quick start puts it plainly: "Kueue creates a Workload object for every managed Job." [14]

These are custom resources in the kueue.x-k8s.io API group. At tag v0.20.7, the packaged CRDs serve v1beta2 as the storage version and mark v1beta1 as not served. [18] The API reference documents types such as ClusterQueue.spec.resourceGroups, LocalQueue.spec.clusterQueue and Workload.spec.podSets. [3]

As checked on 23 November 2026, the official v0.20 installation page pins v0.20.7, and GitHub's releases endpoint reported that version published on 19 November 2026. [15] [19] Don't copy an install URL because it said "latest" last month. Pin the version you tested.

One more line from the install page worth reading twice: Kubernetes 1.34 or newer is "recommended as only such versions are officially supported and tested". [15] Treat that as the supported range, not a promise that older clusters can't run it.

At the airport
Four desks: the gate catalogue, the allocator, each airline's counter, and a ticket for every flight waiting to leave.
In the cluster
ResourceFlavor, ClusterQueue, LocalQueue and Workload. The last one is Kueue's own record of a job's progress through admission.

03 / The front door

What happens when a Job arrives?

A user doesn't submit to a ClusterQueue. The docs define a LocalQueue as "a namespaced object that groups closely related Workloads that belong to a single namespace", and say "Users submit jobs to a LocalQueue, instead of to a ClusterQueue directly." It points to one ClusterQueue. [5]

The user's side is one label on the Job: kueue.x-k8s.io/queue-name: user-queue. [14] Kueue turns that Job into a Workload. A Workload's spec carries the queue name and podSets, "a list of sets of homogeneous pods, each described by a Pod spec and a count". [3]

Then admission runs. Kueue checks "logical resource availability via quota reservation", physical placement through topology-aware scheduling when it's used, and any optional AdmissionChecks. "The Workload is admitted once all AdmissionCheckStates are in the Ready state." [8]

While it waits, the Job is suspended. You don't set that yourself: "you do not need to create the Job in a suspended state. Kueue automatically manages the Job's suspension via webhook and decides when it's the best time to start the Job." [10] Under the covers that's the standard Job .spec.suspend field, which you can flip between true and false. [17]

Figure 1 · Does this cluster need a queue?

1. Do two or more teams share a pool of constrained capacity?
2. Can the jobs wait for a turn?
3. Does a half-started job waste capacity or fail outright?

Answer the three questions to see where Kueue earns its keep.

This is my rule of thumb, not a Kueue rule. The underlying facts are that Kueue gates admission, manages quota and can hold a job until its whole pod set fits.
At the airport
The airline's counter takes the booking and issues a ticket. The plane stays at the stand until the gate desk says go.
In the cluster
A label sends the Job to a LocalQueue. Kueue writes a Workload, suspends the Job and admits it when the quota and checks are ready.

04 / Different machines

Why do you need a ResourceFlavor?

Because "resources in a cluster are typically not homogeneous". The docs list pricing and availability (spot versus on-demand), architecture (x86 versus ARM) and brand or model (Radeon 7000 versus Nvidia A100 versus T4). [4]

A ResourceFlavor "represents these resource variations and allows you to associate them with cluster nodes through labels, taints and tolerations". [4] The fields are spec.nodeLabels, spec.nodeTaints and spec.tolerations. [3] Node labels pick the subset of nodes: the docs say to configure .spec.nodeLabels with labels that "uniquely identify the nodes". [4]

Flavor taints behave like node taints with one difference: only NoExecute and NoSchedule are supported, and PreferNoSchedule is ignored. [4] If your nodes really are the same, you can create a flavor with no labels or taints at all. [4]

Don't over-read this

A flavor describes capacity for quota accounting. It doesn't by itself guarantee where a pod lands. The docs' flavor page describes the label and taint association; placement still goes through the rest of the scheduling path. [4]

At the airport
Some gates fit wide-body aircraft, some fit narrow bodies. The catalogue says which is which, so the allocator doesn't promise a small gate to a big plane.
In the cluster
A flavor separates spot from on-demand or A100 from T4. Node labels and taints tie the flavour to the machines that provide it.

05 / Who gets what

How does a ClusterQueue hand out capacity?

A ClusterQueue is cluster-scoped and "governs a pool of resources such as pods, CPU, memory, and hardware accelerators". The docs add a boundary worth respecting: "Only batch administrators should create ClusterQueue objects." [6]

Quotas live in spec.resourceGroups. Each resource group defines coveredResources and a list of flavors, and each flavor lists resources with a nominalQuota — "the quantity of this resource that is available for a ClusterQueue at a specific time". [6] [3]

Here's where it stops being a hard wall. ClusterQueues can join a cohort with spec.cohortName (spelled that way in the API reference and examples). [7] [3] "ClusterQueues that belong to the same cohort can borrow unused quota from each other." [6] Two fields shape that: borrowingLimit caps what this queue may take from others, and lendingLimit caps what others may take from it. [6] A queue with no cohort can't borrow, and you can only borrow flavor-and-resource pairs the queue actually defines. [3]

Figure 2 · Two queues, one shared pool

Team A · nominal 8

A using 0 of 8

Team B · nominal 8

B using 0 of 8

Both queues sit at zero. Press Next step to watch borrowing and reclaim.

Toy numbers in the figures. A and B each have a nominal quota of 8 in the same cohort. Reclaiming borrowed capacity needs reclaimWithinCohort; its documented default is Never. [6]
At the airport
Airlines in an alliance can use each other's spare gates. The agreement says how much you may borrow, and how much you may lend.
In the cluster
Cohort members borrow unused nominal quota, bounded by borrowingLimit, lendingLimit and the flavors each queue defines.

06 / The promise

What does all-or-nothing really promise?

Start with the rule, then its limit. "By default, a Workload is only unsuspended when the quota for all of its pod sets can be reserved at once. By default, Kueue does not admit a fraction of a Workload (unless Partial Admission is explicitly enabled to allow scaling down pod sets)." [9]

That's a quota-accounting promise. The same page warns that "reserving aggregate quota alone does not guarantee that Pods can actually schedule. Quota tracks total quantities of resources, whereas scheduling depends on node layout, physical node availability, and node fragmentation." [9]

Kueue has other mechanisms for the physical side — topology-aware scheduling, ProvisioningRequest and waitForPodsReady — but they aren't the same guarantee. The waitForPodsReady check is called "a heuristic: it does not prevent partial scheduling, but it guarantees that a partially scheduled workload does not hold resources indefinitely". ProvisioningRequest scale-up is "best effort" and depends on the provider. [9]

Figure 3 · The admission gate

Job A needs 6 CPU and Job B needs 5. Press Next step to submit A.

Job A wants 6 pods of 1 CPU; Job B wants 5. Partial Admission is explicitly opt-in for Batch Job in the v0.20 docs; don't assume it's on. [9] [11]
At the airport
A flight needing two gates waits for both. The desk doesn't send one plane and leave the other in a holding pattern, unless the airline explicitly allows a smaller group.
In the cluster
By default the Workload stays suspended until every pod set fits the reserved quota. That's a quota decision; node placement is still the scheduler's.

07 / Taking a turn back

When does preemption kick in?

"Preemption is the process of evicting one or more admitted Workloads to accommodate another Workload." [11] In a ClusterQueue it happens when an incoming Workload can't fit the remaining quota or the cohort, based on that queue's policies. [6]

The policy you'll reach for first is withinClusterQueue:

  • Never — the default. Nothing is preempted in this queue. [6]
  • LowerPriority — only workloads with lower priority than the pending one. [6]
  • LowerOrNewerEqualPriority — lower priority, or equal priority but newer than the pending workload. [6]

The cohort adds two more switches. reclaimWithinCohort lets a pending workload take back nominal quota that another queue is borrowing; borrowWithinCohort governs preemption when borrowing is needed, with an optional maxPriorityThreshold. All three — reclaimWithinCohort, borrowWithinCohort.policy and withinClusterQueue — default to Never. [11] [6] borrowWithinCohort is for Classical Preemption only, not Fair Sharing, and it only takes effect when reclaimWithinCohort is set to something other than Never. [6]

Priority comes from the Workload. It "influences the order in which they are admitted by a ClusterQueue", and a WorkloadPriorityClass lets you set it with the label kueue.x-k8s.io/priority-class without changing the pod's priority. [12] When it does preempt, the algorithm "tries to find a minimal set of Workloads to preempt", lower priority first. [3]

What I'd do
  1. Leave preemption off during the pilot. The defaults are Never for a reason.
  2. Then enable withinClusterQueue: LowerPriority before touching cohort-wide reclamation.
  3. Give the jobs that may be evicted a checkpoint or restart path. An eviction deletes active pods.
At the airport
A delayed emergency flight can ask a lower-priority flight to give up its gate. You don't want that happening without a published rule.
In the cluster
Preemption evicts admitted Workloads. Its three main policy fields default to Never, and priority decides who goes first.

08 / Seeing the queue

How do you see what the queue is doing?

Kueue "exposes prometheus metrics to monitor the health of the system and the status of ClusterQueues and LocalQueues". [13] The names are worth knowing before you build dashboards:

  • kueue_pending_workloads — pending workloads per ClusterQueue and status. [13]
  • kueue_admission_wait_time_seconds — time from creation or requeue to admission, per ClusterQueue. [13]
  • kueue_quota_reserved_workloads_total — how many workloads got a quota reservation. [13]
  • kueue_preempted_workloads_total — preemptions per preempting_cluster_queue, with reason values InClusterQueue, InCohortReclamation, InCohortFairSharing and InCohortReclaimWhileBorrowing. [13]
  • kueue_admission_attempts_total — attempts with a result of success or inadmissible. [13]

Two caveats from the same page. LocalQueue status metrics are alpha and only appear when the LocalQueueMetrics feature gate is on. The per-ClusterQueue resource gauges, such as kueue_cluster_queue_nominal_quota and kueue_cluster_queue_resource_usage, need metrics.enableClusterQueueResources in the manager's configuration. [13]

For the first week, I'd watch pending workloads and admission wait time per queue. If those climb, teams are waiting. If preemptions climb, someone's job is losing work.

09 / Hands-on

How do you stand up a working queue?

You've got the concepts; now you need something you can actually run. This follows the v0.20 quick start and installation pages. Use a throwaway cluster. Every URL and field below comes from those pages. [14] [15]

Step 1. Install the pinned release. [15]

kubectl apply --server-side -f https://github.com/kubernetes-sigs/kueue/releases/download/v0.20.7/manifests.yaml
kubectl wait deploy/kueue-controller-manager -nkueue-system --for=condition=available --timeout=5m

Step 2. Create the three queue objects. This is the quick start's own manifest: an empty flavor, a ClusterQueue with 9 CPU and 9Gi memory, and a LocalQueue in the default namespace. [14]

apiVersion: kueue.x-k8s.io/v1beta2
kind: ResourceFlavor
metadata:
  name: "default-flavor"
---
apiVersion: kueue.x-k8s.io/v1beta2
kind: ClusterQueue
metadata:
  name: "cluster-queue"
spec:
  namespaceSelector: {} # match all namespaces
  resourceGroups:
  - coveredResources: ["cpu", "memory"]
    flavors:
    - name: "default-flavor"
      resources:
      - name: "cpu"
        nominalQuota: 9
      - name: "memory"
        nominalQuota: 9Gi
---
apiVersion: kueue.x-k8s.io/v1beta2
kind: LocalQueue
metadata:
  namespace: "default"
  name: "user-queue"
spec:
  clusterQueue: "cluster-queue"
kubectl apply -f https://kueue.sigs.k8s.io/examples/getting-started/quick-start-setup.yaml
kubectl get clusterqueue cluster-queue -o wide
kubectl get localqueue user-queue -n default -o wide

The -o wide output shows ACTIVE and REASON. The quick start says an active queue shows True and Ready. [14]

Step 3. Submit a Job with the queue label. The label is what sends it to the LocalQueue. [14]

apiVersion: batch/v1
kind: Job
metadata:
  name: sample-job
  namespace: default
  labels:
    kueue.x-k8s.io/queue-name: user-queue
spec:
  parallelism: 3
  completions: 3
  template:
    spec:
      containers:
      - name: dummy-job
        image: registry.k8s.io/e2e-test-images/agnhost:2.53
        command: ["/bin/sh"]
        args: ["-c", "sleep 30"]
        resources:
          requests:
            cpu: "1"
            memory: "200Mi"
      restartPolicy: Never
kubectl apply -f https://kueue.sigs.k8s.io/examples/getting-started/quick-start-job.yaml
kubectl get workloads -n default

The Workload is Kueue's view of that Job. The docs' sample output shows its QUEUE as user-queue and RESERVED IN as cluster-queue. Once admitted, kubectl get pods -n default and kubectl get jobs -n default show the pods running and the completions climbing. [14]

Step 4. Clean up. [14]

kubectl delete job sample-job -n default
kubectl delete localqueue user-queue -n default
kubectl delete clusterqueue cluster-queue
kubectl delete resourceflavor default-flavor

That's a working queue, not a quota design. Real designs start with one flavor per kind of capacity, one ClusterQueue per team or pool, and a cohort only where borrowing is wanted.

Figure 4 · The pilot at a glance

  1. Pin and install a released version
  2. Create ResourceFlavor, ClusterQueue, LocalQueue
  3. Check both queues are Active and Ready
  4. Label a Job with the LocalQueue name
  5. Watch the Workload, then the pods
  6. Watch pending workloads and wait time
All 6 steps
  1. Six steps to a working queue. The quota design comes after this works.
The same order as the commands above.

10 / The decision

When would you skip Kueue?

Here's my honest take. If one team owns the cluster and the workloads fit, don't add another controller. The scheduler plus ordinary quota is less machinery to operate. Kueue earns its place when several teams compete for scarce capacity, jobs can wait, and you need a fair, all-or-nothing decision that you can explain from an object's status.

Keep these limits in view when you design the pilot:

  • Quota is not placement. Aggregate reservation ignores node layout and fragmentation. [9]
  • All-or-nothing has exceptions. Partial Admission is opt-in, and waitForPodsReady is a heuristic, not atomic placement. [9]
  • Preemption is off by default. All three main policy fields default to Never. [6]
  • Features aren't uniform across integrations. The docs ship a feature matrix; don't assume every job type supports every feature. [1]
  • Pin the version. The v0.20 docs pin v0.20.7, and the served API version at that tag is v1beta2. [15] [3]

Kueue lists built-in integrations for Batch Job, JobSet, Kubeflow training jobs, RayJob/RayCluster, AppWrapper and plain Pods/Pod Groups. Deployments and StatefulSets are listed separately as serving workloads under "Mixing training and inference". [1] That's a reason to plan, not a reason to switch everything over at once. Start with batch Jobs, prove the queue, then add job types one at a time.

Keep these names

A small glossary

Admission
The point at which Kueue allows a Workload to start and its pods to be created.
ResourceFlavor
A kind of capacity, such as spot or on-demand, mapped to nodes with labels and taints.
ClusterQueue
Cluster-scoped quota for one or more flavors. Can join a cohort to borrow unused quota.
LocalQueue
A namespaced queue that users submit to, pointing at one ClusterQueue.
Workload
Kueue's record of a managed job, including its pod sets and admission state.
resourceGroups
The ClusterQueue field that lists covered resources, flavors and nominalQuota values.
nominalQuota
The quantity of a resource available to a ClusterQueue at a given time.
Cohort
A group of ClusterQueues that can lend and borrow unused quota under set limits.
Preemption
Evicting admitted Workloads to make room for another, only when a policy allows it.
All-or-nothing
By default, a Workload waits until quota for all its pod sets can be reserved at once.

Check the concept

Can you explain it back?

1. A job's pods are Pending. Is that Kueue's doing?

If the Job is Kueue-managed and hasn't been admitted, its pods don't exist yet. The scheduler handles pods that are already created and unassigned.

2. Which object does a user name in a Job label?

The LocalQueue, with kueue.x-k8s.io/queue-name. It maps to one ClusterQueue.

3. Why would you define two ResourceFlavors in one cluster?

Because the capacity differs — spot versus on-demand, x86 versus ARM, or different GPU models — and you want to quota them separately.

4. What does joining a cohort change?

Members can borrow each other's unused nominal quota, bounded by borrowingLimit, lendingLimit and the flavors each queue defines.

5. Quota for all of a job's pods is reserved. Will they definitely land on nodes?

No. Aggregate quota doesn't account for node layout, physical availability or fragmentation. Placement is still the scheduler's job.

Continue the thread

Around the same cluster

Read further

Sources

All accessed 23 November 2026. Kueue docs are the versioned v0.20 pages; tagged source and manifests are pinned to v0.20.7, which was the release returned by GitHub's releases endpoint that day.

  1. Kueue v0.20 docs: Overview
  2. Kueue v0.20 docs: Concepts
  3. Kueue v0.20 docs: kueue.v1beta2 API reference
  4. Kueue v0.20 docs: ResourceFlavor
  5. Kueue v0.20 docs: LocalQueue
  6. Kueue v0.20 docs: ClusterQueue
  7. Kueue v0.20 docs: Cohort
  8. Kueue v0.20 docs: Admission
  9. Kueue v0.20 docs: All-or-nothing Scheduling
  10. Kueue v0.20 docs: Run Jobs
  11. Kueue v0.20 docs: Preemption
  12. Kueue v0.20 docs: WorkloadPriorityClass
  13. Kueue v0.20 docs: Metrics
  14. Kueue v0.20 docs: Quick start
  15. Kueue v0.20 docs: Installation
  16. Kubernetes docs: kube-scheduler
  17. Kubernetes docs: Suspending a Job
  18. kubernetes-sigs/kueue v0.20.7: packaged CRDs
  19. GitHub API: kueue releases/latest (checked 23 November 2026)

Written with AI assistance. Technical sources are listed above.