---
title: "Avoiding Kubernetes Pod Topology Spread Constraint Pitfalls"
description: "Kubernetes Pod Topology Spread Constraints with a naive LabelSelector (e.g. just the app label) can produce heavy zone skew during rolling updates, because kube-scheduler counts Pods from both old and new ReplicaSets and never rebalances when old Pods are randomly terminated."
url: "https://swe.quest/articles/avoiding-kubernetes-pod-topology-spread-constraint-pitfalls-e98998a6a64fb2aa"
canonical: "https://medium.com/wise-engineering/avoiding-kubernetes-pod-topology-spread-constraint-pitfalls-d369bb04689e"
source: "Wise Engineering"
published: "2023-03-28"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["kubernetes","scheduling","resilience","deployment"]
---

# Avoiding Kubernetes Pod Topology Spread Constraint Pitfalls

A post on [Wise Engineering](https://swe.quest/sources/wise.md), published 2023-03-28, 6 min read, Case study. Original: [https://medium.com/wise-engineering/avoiding-kubernetes-pod-topology-spread-constraint-pitfalls-d369bb04689e](https://medium.com/wise-engineering/avoiding-kubernetes-pod-topology-spread-constraint-pitfalls-d369bb04689e)

## Summary

Kubernetes Pod Topology Spread Constraints with a naive LabelSelector (e.g. just the app label) can produce heavy zone skew during rolling updates, because kube-scheduler counts Pods from both old and new ReplicaSets and never rebalances when old Pods are randomly terminated. In the worst case an Availability Zone outage could take out 2/3 of a service's Pods instead of 1/3. Wise fixed this with a mutating admission webhook that adds a per-ReplicaSet UUID label to Pods and to the constraint's LabelSelector, so only new-version Pods are considered. Alternatives include manifest tooling changes, the alpha matchLabelKeys field with pod-template-hash in Kubernetes 1.25, descheduler for scale-down imbalance, or per-zone deployments or clusters.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Kubernetes](https://swe.quest/tags/kubernetes.md) (Infrastructure)
- [Scheduling](https://swe.quest/tags/scheduling.md) (Distributed systems)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)

## Prerequisites

- Kubernetes Deployments and ReplicaSets ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))
- Kubernetes label selectors ([easy posts on Kubernetes](https://swe.quest/tags/kubernetes.md?difficulty=easy))
- AWS Availability Zones ([easy posts on Cloud platforms](https://swe.quest/tags/cloud.md?difficulty=easy))

## Keywords

Pod Topology Spread Constraints, kube-scheduler, mutating admission webhook, matchLabelKeys, descheduler, AWS

## Related posts

- [Kubernetes v1.37: Advancing Workload-Aware Scheduling](https://swe.quest/articles/kubernetes-v1-37-advancing-workload-aware-scheduling-ae1f6d242ffec17d.md): Kubernetes Blog · 2026-09-08 · Hard · 15 min read · Kubernetes, Scheduling, ML platforms
  Kubernetes v1.37 promotes the Workload and PodGroup APIs (gang scheduling), workload-aware preemption and shared DRA ResourceClaims for PodGroups to Beta.
- [Kubernetes v1.37: Scheduler Preemption for In-Place Pod Resize (Alpha)](https://swe.quest/articles/kubernetes-v1-37-scheduler-preemption-for-in-place-pod-resize-alpha-876ab10ec3060b0b.md): Kubernetes Blog · 2026-09-10 · Medium · 9 min read · Kubernetes, Scheduling, Capacity planning
  Kubernetes v1.37 adds alpha scheduler preemption for in-place Pod resize behind the InPlacePodVerticalScalingSchedulerPreemption feature gate.
- [Kubernetes v1.36: Advancing Workload-Aware Scheduling](https://swe.quest/articles/kubernetes-v1-36-advancing-workload-aware-scheduling-00f8e4f9a7ae7e81.md): Kubernetes Blog · 2026-05-13 · Hard · 13 min read · Kubernetes, Scheduling, ML platforms
  Kubernetes v1.36 splits workload scheduling into a static Workload template and a runtime PodGroup API (scheduling.k8s.io/v1alpha2). kube-scheduler gains a PodGroup scheduling cycle that snapshots cluster state once and places or rejects a whole group atomically, which is the basis for gang scheduling.
- [Kubernetes v1.37: Pod-Level Resource Managers graduated to Beta](https://swe.quest/articles/kubernetes-v1-37-pod-level-resource-managers-graduated-to-beta-f8563fd0ebc7f697.md): Kubernetes Blog · 2026-09-15 · Hard · 2 min read · Kubernetes, Performance engineering
  Kubernetes v1.37 promotes Pod-Level Resource Managers to Beta behind the \`PodLevelResourceManagers\` feature gate, disabled by default.
- [A Recap on May/June Stability](https://swe.quest/articles/a-recap-on-may-june-stability-4b12711289993df6.md): Neon · 2025-07-16 · Medium · 6 min read · Incidents & postmortems, Scaling, Kubernetes, PostgreSQL, Serverless
  Neon's May and June 2025 incidents were caused by a load surge from agentic AI platforms.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
