Max skew limits how unevenly Kubernetes spreads a workload’s Pods across topology domains. A value of 1 permits at most one more Pod in any domain than in the others. section 8.2.1
Use max skew together with the other topology-spread settings:
- Set topologyKey to define the domains being compared; kubernetes.io/hostname targets individual nodes. section 8.2.1
- Set whenUnsatisfiable to DoNotSchedule for strict placement or ScheduleAnyway for a softer production preference. section 8.2.1
- Match labelSelector with the Deployment’s Pod labels so Kubernetes spreads the intended workload. section 8.2.1
- Verify that nodes actually carry the selected topology label before deploying. section 8.2.1
Three replicas across three nodes
A Deployment with replicas: 3, topologyKey: kubernetes.io/hostname, and maxSkew: 1 asks Kubernetes to keep replica counts nearly even across nodes. kubectl get pods -o wide lets you inspect the resulting placement.
