Skip to content

Commit 007d252

Browse files
authored
Merge pull request #32340 from tengqm/mindomainsintopologyspread
Document the new MinDomainsInPodTopologySpread feature gate
2 parents 0bf133e + e4a473c commit 007d252

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

content/en/docs/concepts/workloads/pods/pod-topology-spread-constraints.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,42 @@ You can define one or multiple `topologySpreadConstraint` to instruct the kube-s
7373

7474
- **maxSkew** describes the degree to which Pods may be unevenly distributed.
7575
It must be greater than zero. Its semantics differs according to the value of `whenUnsatisfiable`:
76+
7677
- when `whenUnsatisfiable` equals to "DoNotSchedule", `maxSkew` is the maximum
7778
permitted difference between the number of matching pods in the target
7879
topology and the global minimum
79-
(the minimum number of pods that match the label selector in a topology domain. For example, if you have 3 zones with 0, 2 and 3 matching pods respectively, The global minimum is 0).
80+
(the minimum number of pods that match the label selector in a topology domain.
81+
For example, if you have 3 zones with 0, 2 and 3 matching pods respectively,
82+
The global minimum is 0).
8083
- when `whenUnsatisfiable` equals to "ScheduleAnyway", scheduler gives higher
8184
precedence to topologies that would help reduce the skew.
85+
86+
- **minDomains** indicates a minimum number of eligible domains.
87+
A domain is a particular instance of a topology. An eligible domain is a domain whose
88+
nodes match the node selector.
89+
90+
- The value of `minDomains` must be greater than 0, when specified.
91+
- When the number of eligible domains with match topology keys is less than `minDomains`,
92+
Pod topology spread treats "global minimum" as 0, and then the calculation of `skew` is performed.
93+
The "global minimum" is the minimum number of matching Pods in an eligible domain,
94+
or zero if the number of eligible domains is less than `minDomains`.
95+
- When the number of eligible domains with matching topology keys equals or is greater than
96+
`minDomains`, this value has no effect on scheduling.
97+
- When `minDomains` is nil, the constraint behaves as if `minDomains` is 1.
98+
- When `minDomains` is not nil, the value of `whenUnsatisfiable` must be "`DoNotSchedule`".
99+
100+
{{< note >}}
101+
The `minDomains` field is an alpha field added in 1.24. You have to enable the
102+
`MinDomainsInPodToplogySpread` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
103+
in order to use it.
104+
{{< /note >}}
105+
82106
- **topologyKey** is the key of node labels. If two Nodes are labelled with this key and have identical values for that label, the scheduler treats both Nodes as being in the same topology. The scheduler tries to place a balanced number of Pods into each topology domain.
107+
83108
- **whenUnsatisfiable** indicates how to deal with a Pod if it doesn't satisfy the spread constraint:
84109
- `DoNotSchedule` (default) tells the scheduler not to schedule it.
85110
- `ScheduleAnyway` tells the scheduler to still schedule it while prioritizing nodes that minimize the skew.
111+
86112
- **labelSelector** is used to find matching Pods. Pods that match this label selector are counted to determine the number of Pods in their corresponding topology domain. See [Label Selectors](/docs/concepts/overview/working-with-objects/labels/#label-selectors) for more details.
87113

88114
When a Pod defines more than one `topologySpreadConstraint`, those constraints are ANDed: The kube-scheduler looks for a node for the incoming Pod that satisfies all the constraints.

content/en/docs/reference/command-line-tools-reference/feature-gates.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ different Kubernetes components.
149149
| `MemoryManager` | `false` | Alpha | 1.21 | 1.21 |
150150
| `MemoryManager` | `true` | Beta | 1.22 | |
151151
| `MemoryQoS` | `false` | Alpha | 1.22 | |
152+
| `MinDomainsInPodTopologySpread` | `false` | Alpha | 1.24 | |
152153
| `MixedProtocolLBService` | `false` | Alpha | 1.20 | 1.23 |
153154
| `MixedProtocolLBService` | `true` | Beta | 1.24 | |
154155
| `NetworkPolicyEndPort` | `false` | Alpha | 1.21 | 1.21 |
@@ -989,6 +990,8 @@ Each feature gate is designed for enabling/disabling a specific feature:
989990
NUMA topology.
990991
- `MemoryQoS`: Enable memory protection and usage throttle on pod / container using
991992
cgroup v2 memory controller.
993+
- `MinDomainsInPodTopologySpread`: Enable `minDomains` in Pod
994+
[topology spread constraints](/docs/concepts/workloads/pods/pod-topology-spread-constraints/).
992995
- `MixedProtocolLBService`: Enable using different protocols in the same `LoadBalancer` type
993996
Service instance.
994997
- `MountContainers`: Enable using utility containers on host as the volume mounter.

0 commit comments

Comments
 (0)