Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • C#
  • Asp.Net Core
  • SQL
  • Windows
  • WordPress
  • AI
  • JavaScript
  • CSS
  • MORE
    • HTML
    • Ajax
    • Git
    • Docker
    • Kubernetes
    • Photoshop
    • Visual Studio
Kubernetes

Kubernetes: Fix Topology Spread Constraints Leaving Pods Pending

- 01.12.26 - ErcanOPAK

☸️ Fix Topology Spread Constraints Leaving Pods Pending

A topologySpreadConstraint with whenUnsatisfiable: DoNotSchedule tells the scheduler to refuse placement entirely rather than accept an uneven spread, and on a cluster with fewer available zones or nodes than the constraint’s maxSkew math requires — common right after a node pool scales down, or in a cluster with an odd number of zones — the scheduler has no valid placement that satisfies the constraint, so pods sit in Pending indefinitely with no obvious resource shortage to explain why.

🔎 The Problem

topologySpreadConstraints:
- maxSkew: 1
  topologyKey: topology.kubernetes.io/zone
  whenUnsatisfiable: DoNotSchedule
  labelSelector:
    matchLabels: { app: checkout }
# kubectl get pods: 2 Pending
# kubectl describe pod: "0/6 nodes are available: 3 node(s) didn't
# match pod topology spread constraints, 3 node(s) had taints..."
# Cluster currently has only 2 usable zones, not the 3 the deployment expects

✅ Fix: Match the Constraint to What the Cluster Can Actually Offer

  • Switch whenUnsatisfiable to ScheduleAnyway for workloads where an even spread is a preference rather than a hard requirement, so the scheduler does its best instead of refusing to place the pod at all.
  • If an even spread truly is mandatory, either raise maxSkew to a value the current zone count can satisfy, or fix the underlying zone/node shortage (restore the scaled-down node pool) before relying on the stricter constraint again.
  • Add a kubectl get nodes -L topology.kubernetes.io/zone check to your deployment pipeline so a DoNotSchedule constraint’s assumptions about zone count get validated before it ever reaches production.

DoNotSchedule means exactly what it says — if the cluster can’t satisfy the spread you asked for, the pod simply doesn’t get a node.

— Cloud Architect

Related posts:

Kubernetes: Fix a CronJob That Silently Skips Its Scheduled Run Because the Previous Job Is Still Ma...

Kubernetes: Fix a CronJob That Silently Skips Its Scheduled Run Because the Previous Job Is Still Ma...

Kubernetes: Use Pod Affinity to Schedule Related Pods Together

Kubernetes: Use Pod Affinity to Schedule Related Pods Together

Kubernetes: Fix Pods Losing Name Resolution the Moment a Default-Deny Policy Is Applied Because Egre...

Kubernetes: Fix Pods Losing Name Resolution the Moment a Default-Deny Policy Is Applied Because Egre...

Views: 0
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

JavaScript: Fix Promise.any Throwing an Unhelpful Aggregate Error
The AI Prompt That Finds Duplicate Logic Copied Across Two Files

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Read

  1. 01How to make theater mode the default for Youtube 1,079 views
  2. 02How to add default value for Entity Framework migrations for DateTime and Bool 997 views
  3. 03Get the User Name and Domain Name from an Email Address in SQL 996 views
  4. 04Get the First and Last Word from a String or Sentence in SQL 873 views
  5. 05How to select distinct rows in a datatable in C# 868 views
  6. 06How to enable, disable and check if Service Broker is enabled on a database in SQL Server 671 views
  7. 07Add Constraint to SQL Table to ensure email contains @ 631 views
  8. 08Average of all values in a column that are not zero in SQL 584 views
  9. 09How to use Map Mode for Vertical Scroll Mode in Visual Studio 561 views
Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
Back to top
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com