Configure topology spread constraints with minDomains and nodeAffinityPolicy for zonal autoscaling

domain: kubernetes.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add a topologySpreadConstraints entry to the pod template with topologyKey: topology.kubernetes.io/zone, whenUnsatisfiable: DoNotSchedule, and a labelSelector matching the workload's pods.
  2. Set minDomains to the minimum number of zones the scheduler should treat as eligible even if fewer currently have ready nodes (e.g. minDomains: 3 for a 3-AZ cluster); this only takes effect when whenUnsatisfiable is DoNotSchedule, and is stable/GA since Kubernetes 1.30 (beta-by-default since 1.27).
  3. Set nodeAffinityPolicy: Honor (the default) so skew is calculated only over nodes matching the Pod's own nodeAffinity/nodeSelector, keeping zonal skew accurate when a cluster-autoscaler node group spans zones unevenly; nodeAffinityPolicy graduated to GA in Kubernetes 1.33 (beta-by-default since 1.26).
  4. Optionally add nodeTaintsPolicy: Honor so newly added but still-tainted autoscaler nodes aren't counted toward domain eligibility until they become schedulable.
  5. Apply the workload and verify placement with kubectl get pods -o wide --sort-by=.spec.nodeName, and confirm every node carries the topology.kubernetes.io/zone label with kubectl get nodes -L topology.kubernetes.io/zone, since minDomains and nodeAffinityPolicy calculations depend on that label being set correctly.

Known gotchas

Related routes

Configure topology spread constraints to distribute pods evenly across availability zones
kubernetes.io · 5 steps · unrated
Configure Kubernetes topology spread constraints with matchLabelKeys to distribute pods across availability zones using rolling-update-aware spreading
kubernetes.io · 6 steps · unrated
configure scale-to-zero autoscaling for a hugging face inference endpoint
huggingface.co/docs/inference-endpoints · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans