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 Liveness Probe That Kills Healthy Pods Under Normal Load

- 27.09.26 - ErcanOPAK

☸️ The Liveness Probe That Punished the Pod for Working Hard

A liveness probe configured with a tight timeout and a low failure threshold assumes a healthy application always responds quickly – but a genuinely healthy app under real load can legitimately take longer to answer a health check request during a garbage collection pause, a cold cache warming up, or simply a busy moment handling real traffic. When the probe’s patience runs out before the app actually fails, kubelet kills a perfectly healthy pod and restarts it, which briefly makes things WORSE (a fresh pod has an even colder cache) and can repeat in a self-inflicted cycle that looks exactly like an application bug from the outside.

🔎 The Problem

livenessProbe:
  httpGet:
    path: /healthz
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 5
  timeoutSeconds: 1        # Very tight - one second to respond
  failureThreshold: 1      # A SINGLE slow response kills the pod

# Under normal peak traffic, a brief GC pause or a moment of genuinely
# high CPU contention can push the health endpoint'"'"'s response time
# past one second - the app never actually stopped working, but the
# probe treats one slow reply, even once, as total failure and kubelet
# restarts the pod immediately.

✅ Fix: Give the Probe Room to Tolerate Real, Transient Slowness

  • Raising failureThreshold above 1 (commonly 3 or higher) means a single slow response doesn’t trigger a restart – only a sustained run of failures does, which is a much better signal of the app actually being stuck rather than merely busy for a moment.
  • A more generous timeoutSeconds, sized against the health endpoint’s actual observed response time under real peak load (not its response time when idle), stops the probe from timing out on responses that are slow but still well within a reasonable bound.
  • Separating liveness (is the process fundamentally stuck, deadlocked, or crashed) from readiness (is the pod currently able to serve traffic well) lets a pod under temporary heavy load fail readiness – and get temporarily removed from the load balancer – without being killed and restarted outright by a liveness failure it didn’t actually deserve.

⚠️ Why This Is Easy to Configure Wrong From the Start

  • Tight, aggressive probe settings look responsible when first configured – they seem to guarantee fast detection of a genuinely stuck pod – and they work fine in early testing under light load, which is exactly when nobody yet has the real-world response time data needed to size the thresholds correctly.
  • The failure mode is easy to misdiagnose as an application performance bug, since the visible symptom (pods restarting under load) looks like the app itself can’t handle the traffic – checking pod restart events and their reason (a liveness probe failure specifically, versus an actual crash) is the fastest way to tell the two apart.

A liveness probe that can’t tell ‘stuck’ from ‘busy’ will eventually kill a pod for the crime of working exactly as hard as it’s supposed to.

— Cloud Architect

Related posts:

Kubernetes: Mastering HPA for Elastic Traffic Management

Kubernetes: Mastering HPA for Elastic Traffic Management

Use Resource Requests to Prevent Noisy Neighbors

Use Resource Requests to Prevent Noisy Neighbors

Kubernetes: Stop a Rolling Deployment From Taking Down Your Site by Fixing Readiness Probes

Kubernetes: Stop a Rolling Deployment From Taking Down Your Site by Fixing Readiness Probes

Views: 12
Found this useful? Share it
XLinkedInWhatsApp

Post navigation

ASP.NET Core: Fix Output Caching That Serves the Same Response to Every User Regardless of Query String
Ajax: Fix a Cross-Tab Race Where One Browser Tab Silently Overwrites Another’s Save

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