Gang Scheduling
Kubernetes v1.35 [alpha](disabled by default)Gang scheduling ensures that a group of Pods are scheduled on an "all-or-nothing" basis. If the cluster cannot accommodate the entire group (or a defined minimum number of Pods), none of the Pods are bound to a node.
This feature depends on the PodGroup API.
Ensure the GenericWorkload
feature gate and the scheduling.k8s.io/v1alpha2
API group are enabled in the cluster.
How it works
When the GangScheduling plugin is enabled, the scheduler alters the lifecycle for Pods belonging
to a PodGroup that has a gang
scheduling policy.
The process follows these steps for each PodGroup:
The scheduler holds Pods in the
PreEnqueuephase until:- The referenced PodGroup object exists.
- The number of
Podscreated for thePodGroupis at least equal tominCount.
Podsdo not enter the active scheduling queue until both conditions are met.Once the quorum is met, the scheduler attempts to find placements for all Pods in the group. It utilizes the PodGroup scheduling cycle to make a single, atomic scheduling decision.
GangSchedulingplugin implements aPermitextension point that is evaluated for each schedulable Pod during the cycle. This is used to determine whether theminCountconstraint is satisfied, by comparing the number of successfully placed pods against theminCountvalue.If the scheduler finds valid placements for at least the
minCountnumber of Pods, it allows those successfully placed Pods to be bound to their assigned nodes. If it cannot find enough placements to satisfy theminCountrequirement, none of the Pods are scheduled. Instead, they are moved to the unschedulable queue to wait for cluster resources to free up, allowing other workloads to be scheduled in the meantime.
What's next
- Learn about the PodGroup API and its lifecycle.
- Read about PodGroup scheduling policies.
- Read about PodGroup scheduling.