topologySpreadConstraints spread Pods evenly across zones and nodes using maxSkew
Answer: Add spec.topologySpreadConstraints with maxSkew, a topologyKey such as topology.kubernetes.io/zone, whenUnsatisfiable, and a labelSelector matching the workload's Pods. The scheduler will try to put a balanced number of pods into each domain.
Example
spec:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app: web
Fields
maxSkewdescribes the degree to which Pods may be unevenly distributed; it is required and must be greater than zero.topologyKeyis a node label key. Nodes with this label and identical values are in the same topology, and each <key, value> pair is a domain.whenUnsatisfiable:DoNotSchedule(default) tells the scheduler not to schedule the Pod;ScheduleAnywaystill schedules it while prioritizing nodes that minimize the skew.labelSelectorfinds the matching Pods that are counted in each topology domain.matchLabelKeys(optional) lists pod label keys whose values are merged into thelabelSelector; it cannot be set whenlabelSelectorisn't set.minDomains(optional) indicates a minimum number of eligible domains.
There can only be one constraint for a given topologyKey and whenUnsatisfiable value.
Why use it
With only two Pods, you'd prefer not to have both run on the same node, because a single node failure would take the workload offline. As you scale up, you may prefer a similar number of replicas scheduled into each infrastructure zone, to avoid higher latency and network costs between zones.
Defaults
If you configure no cluster-level default constraints, kube-scheduler acts as if you specified maxSkew: 3 on kubernetes.io/hostname and maxSkew: 5 on topology.kubernetes.io/zone, both with ScheduleAnyway. Cluster defaults apply only to Pods that define no constraints and belong to a Service, ReplicaSet, StatefulSet or ReplicationController.
See also
Claims
- id: C1 claim: maxSkew describes how unevenly Pods may be distributed. source: S1 evidence: "describes the degree to which Pods may be unevenly distributed"
- id: C2 claim: DoNotSchedule is the default for whenUnsatisfiable. source: S2 evidence: "
DoNotSchedule(default) tells the scheduler not to schedule it."
- id: C3 claim: The scheduler tries to balance pods across domains. source: S2 evidence: "The scheduler will try to put a balanced number of pods into each domain."
Sources
- [S1] Pod Topology Spread Constraints. Kubernetes docs. https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/ . License: CC-BY-4.0. Accessed 2026-11-18.
- [S2] topology-spread-constraints.md (source page). kubernetes/website (GitHub). https://github.com/kubernetes/website/blob/main/content/en/docs/concepts/scheduling-eviction/topology-spread-constraints.md . License: CC-BY-4.0. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Pod Topology Spread Constraints; kubernetes/website (GitHub), topology-spread-constraints.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes docs, Pod Topology Spread Constraints; kubernetes/website (GitHub), topology-spread-constraints.md (source page). CC-BY-4.0 (https://raw.githubusercontent.com/kubernetes/website/main/LICENSE). Copyright The Kubernetes Authors.
Cite this
iinventedlight. 2026. "topologySpreadConstraints spread Pods evenly across zones and nodes using maxSkew." iinventedlight Library, iil:note:5kv5xjgv, version of 2026-11-18. https://iinventedlight.com/library/notes/kubernetes-topology-spread-constraints/. License: CC-BY-4.0.
@misc{iil_note_5kv5xjgv,
author = {{iinventedlight}},
title = {{topologySpreadConstraints spread Pods evenly across zones and nodes using maxSkew}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/kubernetes-topology-spread-constraints/},
note = {Permanent ID iil:note:5kv5xjgv. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- kubernetes-topology-spread-constraints.table.json (table; CC-BY-4.0)
- kubernetes-topology-spread-constraints.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/kubernetes-topology-spread-constraints.md.