Home / AI & GenAI

AI & GenAIRunbookAdvanced

Runbook: Kueue GPU jobs stay suspended or get preempted - quotas, cohorts, flavors and pods-ready timeouts

Find why Kueue won't admit a fine-tuning or batch inference job, or keeps evicting it. Covers queue state, flavor quota, borrowing, preemption and admitted jobs with Pending pods.

Deepak Bhardwaj7 min read

Applies toKueue with the kueue.x-k8s.io/v1beta2 API (older releases use v1beta1), Kubernetes batch Jobs on GPU nodes

A fine-tuning job has been suspended for hours while GPUs look free, or a running job was evicted at 60% with no error in its logs. With Kueue, these are admission decisions, not scheduler decisions. Work through the checks in order: quota is accounting, and it can disagree with the hardware in both directions.

1. Find which layer is holding the job

NS=team-a; JOB=finetune-42
kubectl -n $NS get job $JOB -o jsonpath='{.spec.suspend}{"  "}{.metadata.labels}{"\n"}'
UIDJ=$(kubectl -n $NS get job $JOB -o jsonpath='{.metadata.uid}')
kubectl -n $NS get workloads -l kueue.x-k8s.io/job-uid=$UIDJ
WL=$(kubectl -n $NS get workloads -l kueue.x-k8s.io/job-uid=$UIDJ -o name)
kubectl -n $NS get $WL -o json | jq '.status.conditions[] | {type,status,reason,message}'

If the label selector returns nothing, list workloads in the namespace and match on owner reference.

What you see Layer Go to
No workload object Job not managed by Kueue 2
No conditions at all Never attempted, blocked behind a StrictFIFO head 3
QuotaReserved=False, reason Inadmissible Queue missing or stopped 2
QuotaReserved=False, reason Pending Quota or flavor 3
QuotaReserved=True, not Admitted Admission check outstanding 4
Admitted=True, pods Pending Real capacity differs from quota 5
Evicted=True Preemption, timeout or stop 6

2. Check the queue path

The chain is Job label → LocalQueue (namespaced) → ClusterQueue → ResourceFlavor.

kubectl -n $NS get job $JOB -o jsonpath="{.metadata.labels['kueue\.x-k8s\.io/queue-name']}{'\n'}"
kubectl -n $NS get localqueue
kubectl get clusterqueue
CQ=gpu-team-a
kubectl get clusterqueue $CQ -o json | jq '{stop: .spec.stopPolicy, ns: .spec.namespaceSelector, cond: .status.conditions}'
kubectl get resourceflavor

Typical findings:

  • Message LocalQueue user-queue doesn't exist: wrong name or wrong namespace.
  • ClusterQueue not Active: it references a ResourceFlavor or admission check that doesn't exist. The condition message names it.
  • stopPolicy: Hold or HoldAndDrain: someone stopped the queue, often for maintenance.
  • Namespace not selected: namespaceSelector: {} matches all namespaces; a label selector may exclude yours.

Resume a stopped queue only once you know why it was stopped:

kubectl patch clusterqueue $CQ --type merge -p '{"spec":{"stopPolicy":"None"}}'

Caution

HoldAndDrain evicts admitted workloads. For maintenance where running jobs should finish, use Hold. A job without checkpoints loses everything on eviction.

3. Read the quota message literally

Two messages look alike but need different fixes:

Message contains Meaning Fix
insufficient quota for ... in flavor Request exceeds what could ever be available Shrink the job, or raise quota or the borrowing limit
insufficient unused quota ..., N more needed Would fit if others finished Wait, or review preemption and lending

See usage against quota:

kubectl get clusterqueue $CQ -o json | jq '
  .spec.resourceGroups[].flavors[] | {flavor: .name, resources}'
kubectl get clusterqueue $CQ -o json | jq '.status.flavorsUsage, .status.flavorsReservation'
kubectl get --raw "/apis/visibility.kueue.x-k8s.io/v1beta2/clusterqueues/$CQ/pendingworkloads" \
  | jq -r '.items[] | [.positionInClusterQueue, .priority, .metadata.namespace, .metadata.name] | @tsv'

The visibility API needs RBAC, and its group version follows the Kueue release.

CPU or memory blocks the GPU job

Every resource the pods request, and that the ClusterQueue covers, must fit in one flavor per resource group. With cpu, memory and nvidia.com/gpu in the same group, an exhausted memory quota blocks a job while GPU quota is free. Size CPU and memory quota from the nodes: if a node has 8 GPUs and 1 TiB of RAM, pair each GPU with its share. Don't forget the pods resource, if you cover it.

A big job starves under BestEffortFIFO

BestEffortFIFO (the default) lets smaller, newer jobs pass a blocked head. On a busy queue, a 16-GPU job might never see 16 free together. StrictFIFO fixes that, at the price of idle GPUs while the head waits. A compromise is a separate ClusterQueue for large jobs with its own nominal quota in the same cohort, so idle quota is still lent.

Borrowing is not happening

Check that both queues have the same cohortName (cohort in v1beta1). Then check borrowingLimit on the borrower and lendingLimit on the lender. An unset limit means no limit of that kind, while 0 means none allowed.

apiVersion: kueue.x-k8s.io/v1beta2
kind: ClusterQueue
metadata: {name: gpu-team-a}
spec:
  cohortName: research
  namespaceSelector:
    matchLabels: {team: a}
  queueingStrategy: BestEffortFIFO
  preemption:
    reclaimWithinCohort: Any
    withinClusterQueue: LowerPriority
  flavorFungibility:
    whenCanBorrow: TryNextFlavor
    whenCanPreempt: TryNextFlavor
  resourceGroups:
  - coveredResources: ["cpu", "memory", "nvidia.com/gpu"]
    flavors:
    - name: a100-reserved
      resources:
      - {name: cpu, nominalQuota: 192}
      - {name: memory, nominalQuota: 1600Gi}
      - {name: nvidia.com/gpu, nominalQuota: 16, borrowingLimit: 8, lendingLimit: 12}

lendingLimit: 12 keeps 4 GPUs always available to the owner without preemption. That is often better than reclaiming everything by evicting someone.

4. Admission checks outstanding

Quota is reserved, but an external check isn't ready: for example a provisioning request for nodes, or a remote cluster.

kubectl -n $NS get $WL -o json | jq '.status.admissionChecks'
kubectl get admissioncheck
kubectl -n $NS get provisioningrequest 2>/dev/null

The workload holds its quota while waiting. One job waiting for unavailable cloud capacity can block the queue behind it, so deactivate it if capacity isn't coming:

kubectl -n $NS patch $WL --type merge -p '{"spec":{"active":false}}'

5. Admitted, but pods stay Pending

Kueue counted quota, but the scheduler found no place. Compare the two:

kubectl -n $NS get pods -l job-name=$JOB
kubectl -n $NS describe pod -l job-name=$JOB | grep -A4 FailedScheduling
kubectl get nodes -l gpu-flavor=a100-reserved \
  -o custom-columns='NODE:.metadata.name,READY:.status.conditions[-1].status,GPU:.status.allocatable.nvidia\.com/gpu,UNSCHED:.spec.unschedulable'

Causes, in the order to check:

  1. Cordoned or failed nodes: quota still counts them. Lower nominal quota during long repairs.
  2. Unmanaged pods: workloads without a queue label use the same GPUs. Kueue doesn't see them.
  3. Fragmentation: 8 GPUs free as 8 × 1 can't hold an 8-GPU pod. Kueue's topology-aware scheduling can help; check support in your release.
  4. Flavor labels: the ResourceFlavor's nodeLabels don't match any node, or its taints aren't tolerated.

All-or-nothing deadlock

Two admitted multi-pod jobs each hold half of the GPUs and wait for the rest. waitForPodsReady in the manager configuration breaks this by evicting after a timeout:

waitForPodsReady:
  timeout: 30m
  recoveryTimeout: 5m
  blockAdmission: false
  requeuingStrategy:
    timestamp: Eviction
    backoffLimitCount: 5
    backoffBaseSeconds: 60
    backoffMaxSeconds: 3600

Older releases also need an explicit enable field; check your version. Set timeout above your slowest image pull, node scale-up and model download combined, or healthy jobs will be evicted during cold start. Without backoffLimitCount, requeues are endless.

6. Evicted or preempted

kubectl -n $NS get $WL -o json | jq '.status.conditions[] | select(.type=="Evicted" or .type=="Preempted")'
kubectl -n $NS get events --sort-by=.lastTimestamp | grep -iE 'preempt|evict' | tail -20
kubectl get workloadpriorityclass
  • Reclaimed by a cohort peer: the job was running on borrowed quota. This is by design under reclaimWithinCohort: Any.
  • PodsReadyTimeout: see section 5.
  • Priority preemption: a higher-priority workload arrived. Check that teams aren't all choosing the top class in kueue.x-k8s.io/priority-class.

Two preemption settings are easy to misread. borrowWithinCohort applies only to classic preemption, not to Fair Sharing. flavorFungibility.whenCanPreempt: MayStopSearch can preempt in the first flavor although a later flavor is empty.

Warning

Don't fix an eviction loop by setting every preemption policy to Never. Owners then can't get their own nominal quota back from borrowers until those jobs finish.

Prevent it next time

  • Alert on inadmissible and old pending work, and on evictions:
sum by (cluster_queue) (kueue_pending_workloads{status="inadmissible"}) > 0
sum by (cluster_queue, reason) (increase(kueue_evicted_workloads_total[1h])) > 5
  • Enable metrics.enableClusterQueueResources to chart usage against quota per flavor.
  • Reconcile nominal quota with allocatable GPUs daily, and report the difference.
  • Require a queue label on GPU namespaces with an admission policy, so unmanaged pods can't break the accounting.
  • Require checkpoints and a tested resume for any job allowed to borrow.