The Kubernetes scheduler places Pods one at a time. A distributed training job usually cannot do useful work until all of its Pods run. If two such jobs start at the same time, each job can get some of the GPUs, and then neither job has enough GPUs to run all of its Pods.
We created two Jobs on a Kubernetes 1.37.0 node with eight simulated GPUs. Each Job has six Pods, and each Pod requests one GPU. In the output below, each line shows a number of Pods, the Job (a or b) and the state of those Pods.
2 a Pending
4 a Running
2 b Pending
4 b Running
The eight running Pods use all eight GPUs, so no GPU is free for the last two Pods of each Job. Neither Job can run all six Pods until someone adds GPUs or deletes one of the Jobs.

Turn on the PodGroup API
Kubernetes 1.37 moved gang scheduling to Beta, and the feature is still off by default. With gang scheduling, the scheduler places a group of Pods, called a gang, only when it can place all of them. If the scheduler cannot place all of them, it places none of them. To turn on gang scheduling, you change two settings on the control plane.
- Turn on the
GenericWorkloadfeature gate on the control plane components. In our kind cluster, the gate was on for the API server, the scheduler, the controller manager and the kubelet. - Turn on the
scheduling.k8s.io/v1beta1API on the API server with--runtime-config=scheduling.k8s.io/v1beta1=true.
To try gang scheduling on a laptop, create a kind cluster with this configuration.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
featureGates:
GenericWorkload: true
runtimeConfig:
"scheduling.k8s.io/v1beta1": "true"
nodes:
- role: control-plane
image: kindest/node:v1.37.0
- role: worker
image: kindest/node:v1.37.0
A kind worker node has no GPUs, so we added eight simulated GPUs to the status of the node. The kubelet does not know about these GPUs. The scheduler reads only the node status, so the simulated GPUs are enough to test scheduling.
kubectl create namespace gang
kubectl patch node kind-worker --subresource=status --type=merge \
-p '{"status":{"capacity":{"nvidia.com/gpu":"8"},"allocatable":{"nvidia.com/gpu":"8"}}}'
If you manage clusters with KubeOne, you set flags and feature gates for the control plane components in the flags and featureGates fields of the KubeOneCluster API. If you set an invalid value in these fields, KubeOne support does not cover the problems that result. You use these fields at your own risk.
Create a PodGroup and add the Pods to it
A PodGroup sets minCount, the number of Pods that the scheduler must be able to place before it binds any Pod of the group to a node. Each Pod names its PodGroup in spec.schedulingGroup.
apiVersion: scheduling.k8s.io/v1beta1
kind: PodGroup
metadata:
name: train
namespace: gang
spec:
schedulingPolicy:
gang:
minCount: 6
---
apiVersion: batch/v1
kind: Job
metadata:
name: train
namespace: gang
spec:
parallelism: 6
completions: 6
template:
spec:
restartPolicy: Never
schedulingGroup:
podGroupName: train
containers:
- name: train
image: registry.k8s.io/pause:3.10
resources:
limits:
nvidia.com/gpu: 1
We then ran the two six-Pod Jobs three more times, with each Job in its own PodGroup. Each time, one Job started all six Pods, and the other Job used no GPU. When we deleted the running Job, the other Job started.
In another test, four of the eight GPUs were already in use when we submitted the Job train. All six Pods of train stayed Pending, and they used no GPU. The scheduler writes the reason in the PodGroupInitiallyScheduled condition of the PodGroup. We wrapped the message to fit the page.
minCount (6) cannot be satisfied: 4 scheduled, 1 remaining, pod group
preemption: No preemption victims found for incoming preemptor
The first part, minCount (6) cannot be satisfied, means that the scheduler could not place all six Pods. The counts after it come from one scheduling attempt. The count “4 scheduled” is the number of Pods for which the scheduler found a free GPU in that attempt. The scheduler bound none of these Pods to a node.
While the six Pods waited, other Pods could use the four free GPUs. During the wait, we submitted a Job with two Pods, and it started at once. When we deleted the Job that used the other four GPUs, all six Pods of train started.
A waiting gang does not reserve GPUs, so small Jobs that arrive later can use the free GPUs before the gang gets them. We did not test a long series of small Jobs. If small Jobs keep arriving, a large gang can wait for a long time. If a large Job must start within a fixed time, use Pod priorities or a job queue.
Two mistakes that leave Pods Pending without events
In our test, the Pods stayed Pending in two cases, and the scheduler wrote no event and no condition on them.
- The Pods name a PodGroup that does not exist. The Pods stay
Pendinguntil someone creates that PodGroup. When we created a PodGroup with that name, the Pods started. - A Job creates three Pods, and their PodGroup has
minCount: 5. The Pods stayPending, because the PodGroup needs five Pods and the Job creates only three.
If a Pending Pod has no events, list the PodGroups with their minCount. Then count the Pods that name each PodGroup.
kubectl get podgroups.scheduling.k8s.io -n gang \
-o custom-columns=NAME:.metadata.name,MIN:.spec.schedulingPolicy.gang.minCount
kubectl get pods -n gang \
-o custom-columns=GROUP:.spec.schedulingGroup.podGroupName \
--no-headers | sort | uniq -c
The command uses the full name podgroups.scheduling.k8s.io, because the Coscheduling plugin and Volcano define their own PodGroup kinds in other API groups.
Who creates the PodGroup
In our test, we created each PodGroup by hand. The Job controller can create a PodGroup from Job.spec.scheduling when a second feature gate, WorkloadWithJob, is on. In 1.37, this gate is alpha and off by default. Without this gate, you or a tool in your platform must create the PodGroup for each Job. In our test, a PodGroup that we created by hand remained after we deleted its Job. So you also need to delete each PodGroup that you create by hand.
If you cannot change the control plane yet
Without a change to the control plane, you can use Kueue to reduce the chance that two Jobs each get only some of the GPUs and then wait for the rest. Set the quota in Kueue to the number of GPUs on your nodes, so that Kueue admits only Jobs that your nodes can run. Since Kueue 0.19, Kueue also evicts a Job when not all of its Pods are ready within the waitForPodsReady timeout. The default timeout is 30 minutes. With this default, a Job that runs only some of its Pods keeps its GPUs for up to 30 minutes, unless you lower the timeout. In Why your Kubernetes GPU job has no Pods, we lowered the timeout to less than a minute and describe the result. With the PodGroup API, the scheduler binds no Pod of a group until it can place minCount Pods, so a waiting Job uses no GPUs.
Kueue 0.19.6 is in the KKP application catalog for the Enterprise Edition. If a Job in Kueue has no Pods at all, read Why your Kubernetes GPU job has no Pods first.





