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 a Rolling Update That Takes Down Every Pod at Once Because maxUnavailable Was Left at Its Default

- 03.10.26 - ErcanOPAK

🔧 The Rolling Update That Took Every Pod Down at the Same Time

A Deployment’s RollingUpdate strategy without explicit maxUnavailable and maxSurge values falls back to 25% for each, which is a sensible, gradual setting for a Deployment with a reasonably large number of replicas. For a Deployment with only one or two replicas, that same percentage rounds in ways that stop being gradual at all, and combined with a resource constraint or a PodDisruptionBudget that delays the new surge pod from scheduling in time, a routine rollout can briefly leave the service with meaningfully fewer available replicas than anyone intended.

🔎 The Problem

apiVersion: apps/v1
kind: Deployment
metadata:
  name: checkout-service
spec:
  replicas: 2
  strategy:
    type: RollingUpdate
    # No explicit maxUnavailable/maxSurge set - defaults apply:
    # maxUnavailable: 25%, maxSurge: 25%
  template:
    spec:
      containers:
        - name: checkout
          image: checkout-service:v2

# With replicas: 2, 25% rounds down for maxUnavailable, so
# Kubernetes leans on maxSurge instead - BUT when resource limits or
# a PodDisruptionBudget block the surge pod from scheduling in time,
# Kubernetes can still take an existing pod down before the new one
# is ready, briefly leaving only 1 of 2 replicas available during
# what looked like it should have been a zero-downtime rollout.

✅ Fix: Set Explicit Numbers, and Add a PodDisruptionBudget

  • Set maxUnavailable and maxSurge explicitly (as absolute numbers, not just percentages) for any Deployment with a small replica count, rather than relying on default percentage-based rounding behavior to produce the gradual rollout a larger replica count would get automatically.
  • Add a PodDisruptionBudget with minAvailable set to the actual number of replicas that must stay up at all times, which gives the scheduler a hard constraint to respect during voluntary disruptions like a rolling update, rather than just a strategy-level hint.
  • For a genuinely small, latency-sensitive service, increase the replica count itself if resources allow it – percentage-based rolling update math naturally gets smoother and more forgiving the more replicas there are to round against.

⚠️ Why This Is Easy to Miss

  • A rolling update strategy configured with no explicit numbers isn’t missing anything from the YAML’s perspective – the defaults are valid and commonly fine, which means this specific gap only shows up for Deployments with a small enough replica count that the default percentages round in an unhelpful direction.
  • The dip in available replicas during a rollout is often brief enough (seconds) that it only gets noticed through an actual request failure rate spike or a PodDisruptionBudget violation alert, not through anything in kubectl rollout status, which reports the rollout as proceeding normally the entire time.

A rolling update’s default settings assume there are enough pods for a percentage to mean something – with only a couple of replicas, that same percentage can round down to zero room for error.

— Cloud Architect

Related posts:

Kubernetes: Fix Pods Evicted Because of Node Memory Pressure

Kubernetes: Fix Pods Evicted Because of Node Memory Pressure

Kubernetes: Fix a Deployment Stuck Mid-Rollout Because readinessProbe Reports Ready Before the App H...

Kubernetes: Fix a Deployment Stuck Mid-Rollout Because readinessProbe Reports Ready Before the App H...

Kubernetes: Set Resource Limits for Stability

Kubernetes: Set Resource Limits for Stability

Views: 9
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

Photoshop: Fix Saved Workspace Layouts That Quietly Revert to Default Every Time You Relaunch
SQL Server: Why a Table Variable Gets a Far Worse Execution Plan Than the Same Query With a Temp Table

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 562 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