Liveness, Readiness, and Startup Probes in Kubernetes: A Deep Dive into Container Health

Liveness, Readiness, and Startup Probes in Kubernetes: A Deep Dive into Container Health

Learn how Kubernetes decides whether your containers are alive, ready for traffic, or still starting up, how each probe behaves and fails, how to tune them safely, and how to avoid the classic mistakes that turn health checks into outages.

Imagine a hospital ward with a nurse who walks the rounds. Every few minutes she checks each patient with three different questions. First: is this patient still alive, or do we need to call the emergency team? Second: is this patient well enough to receive visitors right now? Third: has this new patient finished waking up from surgery, so we can begin the regular checks? Kubernetes has exactly such a nurse on every machine, called the kubelet, and the three questions are the liveness, readiness, and startup probes. Getting these three checks right is one of the most valuable skills for running reliable applications, and getting them wrong is one of the most common causes of mysterious outages.

1Why Health Probes Exist

A running program is not always a working program.

When you start an application in a container, the simplest thing Kubernetes can observe is whether the main process is running. If the process exits, Kubernetes knows something is wrong and can restart it. But many failures are quieter. A web server may be running yet stuck in a deadlock, unable to answer any request. A database client may have lost its connection and be waiting forever. A new application may be running but still loading data into memory and not yet able to serve anyone. From the outside, the process looks fine, while users see errors or endless waiting.

Probes are Kubernetes’ answer to this gap. A probe is a small, repeated check that the kubelet performs against a container to learn something the process status alone cannot tell. By asking the container itself, through a web request, a network connection, or a small command, Kubernetes can tell whether the application is truly healthy and can act automatically: restart it, stop sending it traffic, or wait patiently for it to finish starting.

Simple Analogy

Think of a shop assistant standing behind the counter. Seeing the person standing there tells you they are present, but not whether they are awake, able to serve, or busy in the back room. Asking “Can I help you?” and getting a sensible answer tells you far more. A probe is that question, asked automatically and repeatedly.

What can go wrong without probes

Without probes, Kubernetes assumes that a running container is healthy and ready the moment it starts. Traffic is sent to pods that are still loading. Stuck pods stay in service forever, quietly failing requests. Rolling updates proceed to replace healthy old pods with new pods that cannot yet answer, causing an outage during what should have been a safe release.

3
Probe types, each answering a different question
4
Ways to perform a check: web, network, command, gRPC
0
Probes defined by default
i
Good to know

This guide assumes you know what a pod and a container are, but every new term is explained when it first appears. The focus is on understanding why each probe exists and how they interact, because that understanding matters more than memorising settings.

2How Kubernetes Sees Container Health by Default

Without probes, “running” means “healthy” and “started” means “ready”.

By default, Kubernetes trusts the container’s main process. If the process is alive, the container is considered running. If the process exits, the kubelet restarts it according to the pod’s restart policy. That is the entire health model when no probes are defined. It handles crashes well, since a crashed process is gone, but it is blind to every failure in which the process stays alive.

The same default applies to readiness. A container with no readiness probe is treated as ready as soon as it starts. The pod is added to the Service’s list of endpoints immediately, and traffic begins to flow, whether or not the application inside has finished initialising. For a small program that starts in milliseconds, this is harmless. For a large application that needs half a minute to warm up, it means the first users of every new pod receive errors.

SituationWhat Kubernetes Sees Without ProbesWhat Really Happens
Process crashes and exitsContainer stopped, will be restartedHandled correctly
Process is running but deadlockedContainer running, all fineRequests hang or fail, and nobody restarts it
Application is still loading dataContainer running and readyTraffic arrives and fails until loading finishes
Application lost its database connectionContainer running and readyPod keeps receiving requests it cannot answer
Application is overloaded and slowContainer running and readyMore traffic keeps arriving and makes it worse
flowchart TD
    A[Container process starts] --> B[Kubernetes marks it running and ready]
    B --> C[Service starts sending traffic]
    C --> D{Is the application really able to serve?}
    D -->|Yes| E[Users are served]
    D -->|No, still loading or stuck| F[Users see errors]
    F --> G[Nothing detects the problem]
        
FIG 1 — Without probes, Kubernetes cannot tell a working application from a broken one that is merely running
!
Common Misconception

A green “Running” status on a pod does not mean the application is working. It only means the process exists. Only probes let Kubernetes look inside the application’s behaviour.

3The Three Probes at a Glance

Each probe asks a different question and triggers a different action.

The three probes are easy to confuse because they use the same mechanisms and the same settings. What differs is the question each asks and, crucially, what Kubernetes does when the answer is no. Keeping this distinction clear removes most of the confusion around probes.

Probe 1

Liveness

Question: is this container stuck or broken beyond recovery? Action on failure: the container is killed and restarted.

Probe 2

Readiness

Question: can this container handle traffic right now? Action on failure: the pod is removed from Service endpoints, with no restart.

Probe 3

Startup

Question: has this container finished starting up? Action while running: liveness and readiness checks are held back. Action on failure: the container is restarted.

AspectLivenessReadinessStartup
Main questionShould this container be restarted?Should this pod receive traffic?Is start-up complete?
Action on failureRestart the containerRemove from Service endpointsRestart the container after the allowed attempts
Runs how longWhole life of the container, after start-up completesWhole life of the container, after start-up completesOnly until it succeeds once
Recovers by itselfNo, a restart is the recoveryYes, pod returns when checks passNot applicable, success ends its job
Best forDeadlocks and hung processesWarm-up, overload, temporary troubleSlow-starting applications
Risk if badly setRestart stormsAll pods removed from service at onceRestart loops during a long start-up
Simple Analogy

Back at the hospital: the liveness check asks whether the patient needs the emergency team. The readiness check asks whether the patient can receive visitors now. The startup check asks whether a new arrival has woken up enough to begin the ordinary rounds. Calling the emergency team for a patient who simply cannot have visitors right now would be a costly mistake, and that is exactly the mistake many teams make with probes.

“Liveness decides whether to restart, readiness decides whether to route, and startup decides whether to wait.”

4The Liveness Probe in Depth

The last line of defence against a container that cannot recover on its own.

A liveness probe tells Kubernetes whether a container is still functioning at a basic level. If the probe fails several times in a row, the kubelet concludes that the container is stuck in a state it will never leave by itself, kills it, and starts a new one according to the pod’s restart policy. The whole point is to turn “stuck forever” into “restarted and hopefully healthy.”

Liveness probes are meant for one particular kind of failure: the process is running but cannot make progress. Classic examples are a deadlock between threads, an infinite loop, or an internal component that has crashed while the main process survives. A restart fixes these problems because it resets the program to a clean state. A restart does not fix problems that live outside the container, such as a database outage, and this distinction is the key to using liveness safely.

sequenceDiagram
    participant K as Kubelet
    participant C as Container
    loop Every period
        K->>C: Liveness check
        alt Healthy
            C-->>K: Success
        else Stuck
            C-->>K: Failure or timeout
            K->>K: Count consecutive failures
        end
    end
    K->>C: Failure threshold reached, stop container
    K->>C: Start a new container instance
    Note over K,C: Restart delay grows if the container keeps failing
        
FIG 2 — Repeated liveness failures lead the kubelet to restart the container

What liveness is good at

  • Recovering from deadlocks and hung processes automatically
  • Clearing internal corruption by starting from clean state
  • Reducing the need for people to restart applications by hand
  • Turning silent failure into a visible restart count

What liveness cannot or should not do

  • Fix problems in dependencies such as databases
  • Handle temporary overload gracefully
  • Wait for a slow start-up unless combined with a startup probe
  • Replace proper error handling inside the application
Simple Analogy

A liveness check is like a smoke alarm that rings the fire brigade only when the kitchen is truly on fire. It should not ring because the toast is slightly dark, and it should not ring because the neighbours’ power is out. Its job is narrow and serious.

!
Restart Backoff

If a container keeps failing and restarting, Kubernetes waits longer and longer between attempts, up to a few minutes. This is the familiar crash loop state. Repeated liveness restarts show up as a rising restart count on the pod.

5The Readiness Probe in Depth

The gate that decides whether a pod may receive traffic.

A readiness probe tells Kubernetes whether a container is ready to serve requests at this moment. While the probe succeeds, the pod is listed among the endpoints of every Service that selects it, and traffic flows to it. When the probe fails, the pod is removed from those lists. The container keeps running and is not restarted; it is simply left alone until it reports ready again.

This makes readiness the right tool for anything temporary. A new pod that is still warming its caches is not ready yet. A pod that is busy with an overload may report not ready for a short while to shed load. A pod that has lost a needed connection may become ready again once it reconnects. In all of these cases, restarting would be unnecessary and even harmful, but withholding traffic is exactly right.

stateDiagram-v2
    [*] --> NotReady: container starts
    NotReady --> Ready: readiness probe succeeds
    Ready --> NotReady: readiness probe fails
    NotReady --> Ready: probe succeeds again
    Ready --> [*]: pod terminating, removed from endpoints
        
FIG 3 — A pod moves freely between ready and not ready without any restart
Effect 1

Service endpoints

Only ready pods appear in the list of addresses behind a Service, so traffic avoids pods that are not ready.

Effect 2

Rolling updates

A rollout counts a new pod as available only when it is ready, so a broken new version stalls the rollout instead of replacing healthy pods.

Effect 3

Pod status

The pod’s ready condition follows its containers. A pod is ready only when all of its containers are ready.

Effect 4

Autoscaling and budgets

Autoscalers and disruption budgets treat not-ready pods specially, so readiness quietly influences scaling and maintenance behaviour.

Simple Analogy

A restaurant’s “open” sign is a readiness check. When the kitchen is still preparing for service, the sign says closed, and customers are not sent to a table. Nobody fires the chef or rebuilds the restaurant. The sign flips to open when things are truly ready.

i
Continues for Life

The readiness probe keeps running for the whole life of the container, not just at start-up. A pod can become not ready in the middle of its life and later become ready again, which is a powerful way to handle temporary trouble.

6The Startup Probe in Depth

A patient guardian for applications that take a long time to start.

The startup probe was added to solve a specific problem. Some applications need a long and unpredictable time to start, perhaps because they load large data sets, run migrations, or initialise heavy frameworks. A liveness probe that is strict enough to catch deadlocks quickly will kill such an application while it is still starting, because it cannot answer yet. Loosening the liveness probe to allow for slow starts makes it slow to detect real deadlocks later. It is a painful trade-off.

The startup probe resolves the trade-off by separating the two phases. While the startup probe is running, the liveness and readiness probes are switched off. Once the startup probe succeeds, it stops for good, and the liveness and readiness probes take over with their normal, stricter settings. If the startup probe never succeeds within its allowed budget, the container is killed and restarted.

sequenceDiagram
    participant K as Kubelet
    participant C as Container
    K->>C: Startup check
    C-->>K: Not yet
    K->>C: Startup check
    C-->>K: Not yet
    Note over K,C: Liveness and readiness are paused
    K->>C: Startup check
    C-->>K: Success
    Note over K,C: Startup probe stops, liveness and readiness begin
    loop From now on
        K->>C: Liveness and readiness checks
    end
        
FIG 4 — The startup probe protects a slow start, then hands over to the other two probes

The start-up budget

The maximum time an application is given to start is the failure threshold multiplied by the period. With a period of ten seconds and a failure threshold of thirty, the application has up to five minutes to become healthy. If it starts in twenty seconds, the startup probe succeeds at the next check and the liveness probe begins at once, so a generous budget costs nothing when start-up is quick.

Simple Analogy

A patient waking from surgery is watched patiently by the recovery nurse, who does not sound the alarm because the patient has not yet sat up. Only when the patient is fully awake do the regular ward checks begin. The recovery nurse is the startup probe.

!
Common Mistake

Using a huge initial delay on the liveness probe instead of a startup probe. That delay is always paid, even when the application starts quickly, and it leaves a long blind period after every restart. A startup probe adapts to the real start-up time.

7How the Three Probes Work Together

A container’s life is a sequence of phases, and each probe owns one of them.

When all three probes are defined, they form a sequence. The startup probe guards the first phase, during which nothing else runs. When it succeeds, the liveness and readiness probes begin in parallel and keep running for the remainder of the container’s life. Liveness watches for a permanently stuck container, while readiness watches for a temporarily unfit one.

1

Container starts

The process begins. The pod is not ready, and traffic does not flow to it yet, if a readiness or startup probe is defined.

2

Startup probe runs

The kubelet checks repeatedly whether start-up has finished. Liveness and readiness probes wait.

3

Startup succeeds

The startup probe ends. The liveness and readiness probes now begin their regular schedules.

4

Readiness passes and traffic begins

Once the readiness probe succeeds, the pod joins the Service endpoints and starts receiving requests.

5

Normal life

Readiness may flip on and off as conditions change. Liveness stays quietly passing, unless the container becomes truly stuck.

6

Failure or shutdown

A stuck container is restarted after liveness failures, and the cycle begins again. A terminating pod is removed from endpoints regardless of its probes.

flowchart TD
    S[Container starts] --> SP{Startup probe defined?}
    SP -->|Yes| W[Wait for startup probe to succeed]
    SP -->|No| LR
    W -->|Fails beyond budget| R[Container restarted]
    W -->|Succeeds| LR[Liveness and readiness start]
    LR --> L{Liveness failing repeatedly?}
    L -->|Yes| R
    L -->|No| RD{Readiness passing?}
    RD -->|Yes| T[Pod receives traffic]
    RD -->|No| N[Pod removed from endpoints, keeps running]
    N --> RD
        
FIG 5 — The decision flow of the three probes over a container’s life
i
A Good Default Recipe

For most services, define a startup probe with a generous budget, a readiness probe that reflects real ability to serve, and a simple, forgiving liveness probe that only detects a truly stuck process.

8How a Probe Checks: HTTP, TCP, Command, and gRPC

Four mechanisms, each with its own strengths and blind spots.

Every probe, whichever of the three kinds it is, must perform its check in one of four ways. The kubelet runs the check from the node where the pod lives. The choice of mechanism decides what the probe can actually detect, how much it costs, and what can go wrong with it.

MechanismHow It ChecksCounts as Success WhenBest ForWatch Out For
HTTP requestSends a web request to a path and port on the podThe response status is in the success range, roughly two hundred to three hundred ninety-nineWeb services and APIs with a health endpointA health path that does too much work or requires login
TCP connectionTries to open a network connection to a portThe connection is acceptedNon-web servers such as databases and message brokersProves only that something is listening, not that it works
CommandRuns a command inside the containerThe command exits with a zero statusApplications with a command-line health tool or file-based signalsCosts a new process each time and needs the tool inside the image
gRPC callCalls a standard gRPC health service on a portThe service reports that it is servingServices that already speak gRPCRequires the application to implement the standard health protocol
flowchart LR
    K[Kubelet on the node] -->|web request to pod address| H[HTTP probe]
    K -->|open connection| T[TCP probe]
    K -->|run command inside container| E[Command probe]
    K -->|gRPC health call| G[gRPC probe]
    H --> APP[Application in the container]
    T --> APP
    E --> APP
    G --> APP
        
FIG 6 — The kubelet performs each check from the node using one of four mechanisms
Simple Analogy

To check whether a shop is working, you can ask a question through the door, which is like an HTTP probe. You can knock and see if anyone opens, which is a TCP probe. You can send someone inside to look, which is a command probe. Or you can phone the shop’s dedicated health line, which is gRPC. Knocking is cheap but tells you little, and sending someone inside tells you a lot but costs more.

HTTP for most web applications

A small, dedicated health path that returns quickly and without login is the most common and informative choice for services that already speak web protocols.

TCP for simple servers

When there is no health path, opening the port at least proves the server has started listening. It is a reasonable check for readiness, though weak for liveness because a hung server may still accept connections.

Command for special cases

Useful when the application offers a check tool, or writes a file that shows recent activity. Keep the command light, because it runs a new process on every check.

gRPC when you already use it

Services built on gRPC can implement the standard health protocol and be checked natively, without adding a separate web endpoint just for probes.

9Timing Settings and What They Really Do

Five numbers decide how quickly a probe reacts and how forgiving it is.

All three probes share a small set of timing settings. Learning what each one controls, and how they combine, lets you predict exactly how long Kubernetes takes to notice a problem. Most probe incidents come from settings that were copied without understanding.

SettingDefaultWhat It ControlsNotes
Initial delayZero secondsHow long to wait after the container starts before the first checkA startup probe is usually a better solution than a long delay
PeriodTen secondsHow often the check is repeatedThe minimum is one second
TimeoutOne secondHow long to wait for an answer before counting a failureToo short a timeout causes false failures under load
Success thresholdOneHow many consecutive successes turn a failing probe back to passingMust be one for liveness and startup probes
Failure thresholdThreeHow many consecutive failures mark the probe as failedMultiplied by the period, it sets the reaction time

A worked example

Consider a liveness probe with a period of ten seconds, a timeout of two seconds, and a failure threshold of three. If the application becomes stuck, the first failing check may come up to ten seconds later. Three consecutive failures are needed, each taking up to two seconds to time out, so the container is restarted roughly thirty to forty seconds after the application gets stuck. If you instead used a period of five seconds and a threshold of two, the reaction would take about ten to fifteen seconds, but the probe would be far more sensitive to short glitches.

sequenceDiagram
    participant A as Application
    participant K as Kubelet
    Note over A: Application becomes stuck
    K->>A: Check 1, times out
    Note over K: Failure count 1
    K->>A: Check 2, times out
    Note over K: Failure count 2
    K->>A: Check 3, times out
    Note over K: Failure count 3, threshold reached
    K->>A: Restart container
        
FIG 7 — Reaction time is roughly the failure threshold times the period, plus the timeouts
Simple Analogy

A night watchman who rings the alarm after one missed check would wake the whole street for every cat. A watchman who waits for many missed checks lets a burglar escape. The period and thresholds are how you decide how nervous the watchman should be.

!
The One-Second Timeout Trap

The default timeout is only one second. Under heavy load, or during a brief pause such as memory cleanup, an application may take longer to answer even though it is perfectly healthy. Several such slow answers in a row cause a false failure. Set the timeout to a realistic value for your application under load.

i
Grace on Termination

For liveness and startup probes, you can also set a shorter grace period for the kill that follows a failed probe. This lets a stuck container be stopped quickly, without waiting for the full grace period that is meant for orderly shutdowns.

10Designing Good Health Endpoints

A probe is only as good as the check behind it.

The probe settings tell Kubernetes when and how to ask. The health endpoint decides what the answer means. A poorly designed endpoint makes even perfect settings useless or dangerous. The most important principle is that liveness and readiness answer different questions, so they should usually be different endpoints with different logic.

AspectLiveness EndpointReadiness Endpoint
Question answeredIs the process itself functioning and able to make progress?Can I serve real requests right now?
What to checkOnly internal health, such as the main loop respondingInternal health plus readiness of what is needed to serve, such as caches loaded and required connections open
External dependenciesDo not check themCheck only those without which you truly cannot serve, and with care
CostExtremely cheap, returns immediatelyCheap, with any dependency checks cached briefly
Failure meaningRestarting will probably helpWaiting or traffic redirection will help
Typical path namesSomething like a live or health pathSomething like a ready path
Rule 1

Keep it fast

The endpoint should answer in milliseconds. A slow health check adds load and risks timeouts exactly when the application is under stress.

Rule 2

Keep it honest

Return failure only when something is really wrong, and success only when it is really fine. A check that always says yes is decoration.

Rule 3

Keep it simple

Avoid complicated logic, authentication, and heavy queries. Simple checks fail rarely and are easy to understand.

Rule 4

Keep it separate

Use a distinct endpoint for each probe so that you can tune their meaning independently as the application evolves.

Simple Analogy

Asking a shop assistant “are you awake?” is a quick liveness question. Asking “can you serve me right now, with the till working and stock available?” is a readiness question. Combining them means you would send the assistant home whenever the till is temporarily out of paper, which helps nobody.

i
Naming Convention

Many projects follow the convention used by Kubernetes components themselves, with separate live and ready style paths. Whatever names you choose, keep them consistent across your services so that everyone knows where to look.

11Dependencies and Cascading Failures

The most dangerous mistake in probe design is checking things outside the container.

It is tempting to make a health check verify that the database is reachable, the cache is up, and the other services respond. After all, if the database is down, the application is not really healthy. But what should Kubernetes do about it? If the liveness probe fails because the database is down, Kubernetes restarts the application container. The restart does nothing to fix the database. The restarted application fails the same check and is restarted again. Now every pod of the application is in a restart loop, the application is completely unavailable, and the database, once it recovers, is met by a thundering herd of freshly started pods all connecting at once.

sequenceDiagram
    participant D as Shared database
    participant P as Application pods
    participant K as Kubelet
    D->>D: Becomes unavailable
    P->>K: Liveness checks fail, dependency down
    K->>P: Restart all pods
    P->>D: Reconnect, still down
    K->>P: Restart again
    Note over P: Application fully down, restart loops
    D->>D: Recovers
    P->>D: All pods reconnect at once
    Note over D: Surge of connections may overload it again
        
FIG 8 — A liveness check that depends on a shared database turns a database outage into a full application outage

Readiness and dependencies

Readiness is a better place to consider dependencies, because its failure action, withholding traffic, is gentle and reversible. If a pod cannot reach a database it truly needs, it is reasonable to stop sending it requests until the connection returns. But even here, care is needed. If every pod depends on the same shared service, and that service has a brief outage, every pod becomes not ready at once. The Service then has no endpoints at all, and a partial degradation becomes a total outage, even for requests that did not need the failing service.

Checking a dependency in readiness

  • Stops routing traffic to pods that cannot do their job
  • Pods recover automatically when the dependency returns
  • Makes a single pod’s local connection problem visible

The risks

  • A shared dependency failure removes every pod at once
  • Requests that did not need the dependency are refused too
  • Slow dependency checks add delay and load
  • Flapping dependency makes pods bounce in and out of service
Simple Analogy

If the supplier of tomatoes is late, closing every branch of a restaurant chain helps nobody, and rebuilding the kitchens will not bring the tomatoes any faster. A better plan is to keep serving the dishes that do not need tomatoes, and to be honest on the menu about what is unavailable.

!
Golden Rule

Never make a liveness probe depend on anything outside the container. If a restart cannot fix the problem, the liveness probe must not react to it. For readiness, include only dependencies without which the pod truly cannot serve, and prefer graceful degradation inside the application over marking everything unready.

12Slow Starters and Start-Up Budgets

Giving heavy applications the time they need, without slowing everything else.

Many real applications take a long time to start. Large Java applications, applications that load machine learning models, and legacy systems that run migrations at boot can all take minutes. If probes are not designed with this in mind, Kubernetes will kill the application before it finishes starting, and the application will be stuck in a loop of starting and being killed.

1

Measure the real start-up time

Observe how long the application takes to become healthy on a busy node, not only on an idle laptop. Take the slowest realistic case, not the average.

2

Add a margin

Multiply the slowest observed time by a comfortable factor, for example two, to cover slow disks, busy networks, and image pulls.

3

Convert to threshold and period

Choose a period and compute the failure threshold so that threshold times period covers the budget. A short period makes success detected quickly.

4

Keep liveness strict

With start-up protected, the liveness probe can stay tight and detect real deadlocks quickly, without allowances for slow starts.

5

Revisit when the application changes

A new dependency, larger data set, or extra migration can slow start-up. Review the budget whenever start-up behaviour changes.

ApproachHow It WorksWeakness
Long initial delay on livenessWaits a fixed time before the first checkAlways paid, even when start-up is fast, and leaves a long blind spot after each restart
Very high failure threshold on livenessTolerates many failuresMakes real deadlocks slow to detect for the whole life of the container
Startup probe with generous budgetWaits only as long as needed, then hands over to a strict liveness probeOne more probe to define, but the best trade-off
i
Practical Tip

Also reduce start-up time where you can: smaller images, lazy loading of large data, and moving migrations out of the start-up path. A faster start-up helps probes, rollouts, autoscaling, and recovery all at once.

13Readiness in Rolling Updates, Services, and Autoscaling

Readiness quietly steers several other Kubernetes features.

Readiness does much more than open and close the door to traffic. Several higher-level features use it as their definition of a pod being usable. Understanding these links explains why a poor readiness probe can cause problems in places that seem unrelated to health checks.

Link 1

Rolling updates

A new pod counts as available only when ready. The rollout moves on only after that, so a good readiness probe is what prevents a bad release from replacing healthy pods.

Link 2

Service endpoints

Ready pods are in the endpoint list and receive traffic. Not-ready pods are left out, unless the Service is told to publish them.

Link 3

Horizontal autoscaling

The autoscaler handles not-ready and newly started pods carefully, because their early usage numbers are not representative. Slow readiness slows the autoscaler’s confidence.

Link 4

Disruption budgets

A budget counts only healthy, ready pods when deciding how many may be taken down for maintenance.

Link 5

Minimum ready time

A Deployment can require a pod to stay ready for a number of seconds before counting it as available, adding a safety margin against pods that pass and then fail.

sequenceDiagram
    participant D as Deployment
    participant N as New pod
    participant O as Old pod
    participant S as Service
    D->>N: Create new pod
    N->>N: Start, readiness not yet passing
    Note over D,N: Rollout waits
    N->>S: Readiness passes, joins endpoints
    D->>O: Now safe to remove an old pod
    O->>S: Leaves endpoints
    Note over D: Repeat until all pods are replaced
        
FIG 9 — Readiness decides when a rolling update may safely remove an old pod
Simple Analogy

When replacing waiters in a busy restaurant, the manager only sends an old waiter home after the new one has proved they can carry plates without dropping them. The readiness probe is that proof. Without it, the manager would send everyone home the moment the replacements walked in.

!
Missing Readiness, Broken Rollouts

If a readiness probe is missing or always succeeds, a rollout proceeds even when the new version is broken, and an outage results. A working readiness probe is the single most important safety net of rolling updates.

14Readiness and Graceful Shutdown

Stopping a pod politely takes cooperation between probes, the network, and the application.

When a pod is told to stop, it is marked as terminating and removed from Service endpoints, and the container receives a termination signal. But removal from endpoints and the shutdown signal happen at about the same time, and it takes a moment for load balancers and proxies across the cluster to learn that the pod is gone. During that moment, new requests may still arrive at a pod that has begun shutting down.

sequenceDiagram
    participant K as Kubelet and controllers
    participant E as Endpoint lists
    participant L as Load balancers and proxies
    participant P as Terminating pod
    K->>P: Mark terminating
    par Endpoint removal
        K->>E: Remove pod
        E->>L: Propagate change
    and Shutdown begins
        P->>P: Optional pre-stop delay
        P->>P: Receive termination signal
    end
    L-->>P: Late requests may still arrive
    P->>P: Finish in-flight requests
    P->>K: Exit within grace period
        
FIG 10 — Endpoint removal and shutdown overlap, so a short delay and graceful handling avoid dropped requests

Add a short pre-stop delay

A brief pause before the shutdown signal gives the rest of the network time to stop sending traffic, which removes most connection errors during rollouts.

Handle the termination signal properly

The application should stop accepting new connections, finish current requests, and then exit, rather than dying instantly.

Report not ready when draining

Some applications begin failing their own readiness check as soon as shutdown starts, which helps proxies that use the check directly to stop routing sooner.

Match the grace period to reality

The total grace period must exceed the pre-stop delay plus the longest request, otherwise in-flight work is cut off.

i
Practical Tip

A liveness probe should not fire during graceful shutdown. Keep the shutdown fast enough, and the probe forgiving enough, that a slow but orderly drain is never mistaken for a stuck process.

15Common Failure Modes: Crash Loops, Flapping, and Restart Storms

Probe problems tend to appear in a few recognisable patterns.

Mode 1

Restart loop during start-up

The liveness probe starts checking before the application is ready, fails, and kills it repeatedly. The fix is a startup probe or a more patient budget.

Mode 2

Flapping readiness

The probe alternates between passing and failing, so pods bounce in and out of service. It is often caused by tight timeouts or a check that depends on something unstable.

Mode 3

Restart storm under load

Heavy load makes health checks slow, liveness fails, pods restart, remaining pods take even more load, and the failure spreads across the whole application.

Mode 4

Total unreadiness

Every pod fails readiness at once, usually because of a shared dependency check, and the Service has no endpoints at all.

Mode 5

Silent false success

A check that always passes, such as one that only confirms the process exists, lets broken pods stay in service and hides real problems.

flowchart TD
    A[Traffic spike] --> B[Application slows down]
    B --> C[Health checks exceed timeout]
    C --> D[Liveness fails repeatedly]
    D --> E[Kubelet restarts pods]
    E --> F[Fewer healthy pods]
    F --> G[Remaining pods get even more load]
    G --> B
        
FIG 11 — A restart storm feeds on itself when liveness reacts to slowness
Simple Analogy

Imagine a restaurant so busy that waiters are slow to answer the manager’s “are you all right?” calls. If the manager sends slow waiters home as punishment, the remaining waiters become even more overloaded, and soon nobody is left. Slowness under load is not the same as being stuck, and the response to it must be gentler.

!
Slow Is Not Dead

A liveness probe should distinguish between a container that is slow and one that is stuck. Use generous timeouts and thresholds for liveness, and let readiness, which is reversible, handle overload by temporarily withholding traffic.

16Tuning Probes for Real-World Conditions

The same settings behave differently on a quiet laptop and a busy production node.

Probes tuned on an idle test cluster often fail in production. Real nodes are shared with many other pods, disks are slower, networks are busier, and applications pause for memory cleanup. Tuning probes means choosing values that hold up under these conditions while still reacting quickly enough to real trouble.

ProbePeriodTimeoutFailure ThresholdReasoning
StartupShort, for example five to ten secondsA few secondsHigh enough to cover the slowest start-upNotices success quickly, allows a long total budget
ReadinessShort, for example five to ten secondsModerate, a few secondsLow to moderate, two or threeReacts fairly quickly, because its action is reversible
LivenessLonger, for example ten to twenty secondsGenerous, several secondsModerate to high, three to fiveReacts slowly and deliberately, because its action is disruptive
1

Start with sensible defaults

Begin with the recipe above and the application’s measured behaviour, not with values copied from another team’s service.

2

Test under load

Run load tests and watch whether probes fail during heavy traffic, garbage collection pauses, or node pressure.

3

Simulate real failures

Cause a deadlock, a slow dependency, and a slow start on purpose. Check that each probe reacts as intended, and only as intended.

4

Adjust and record the reasons

Tune values, and write down why they were chosen so that future changes do not undo the reasoning by accident.

i
Asymmetry Principle

Make readiness quick to fail and slow to forgive, or quick both ways, since it is reversible. Make liveness slow to fail, since it is destructive. The consequences of each failure decide how sensitive it should be.

17Performance and Scale Considerations

Probes are cheap individually, but they add up across a large cluster.

Every probe is a small piece of work performed on a schedule. With a few pods this is invisible. In a cluster with thousands of pods, each with two or three probes running every few seconds, the total volume of checks becomes significant, both for the kubelets that run them and for the applications that answer them.

Advantages

  • Checks run on the node, so no central component is loaded
  • Each kubelet handles only the probes of its own pods
  • Cheap checks add almost no overhead
  • Results feed automation without any extra tooling

Disadvantages / Trade-offs

  • Command probes start a new process on every check
  • Heavy health endpoints add load to already busy applications
  • Very short periods multiply the number of checks
  • Many failing probes create a flood of events and restarts
Tip 1

Prefer light mechanisms

HTTP and gRPC checks to a lightweight handler are usually cheaper than launching a command inside the container each time.

Tip 2

Do not probe too often

A period of a few seconds is usually plenty. Extremely short periods add load without meaningfully faster recovery.

Tip 3

Cache expensive checks

If a readiness check must consult something costly, let the application cache the result for a short time and answer probes from the cache.

Tip 4

Reserve capacity for probe handling

Make sure a busy application can still answer its health endpoint, for example by using a separate thread or port so that saturation does not block the checks.

18Security Considerations

Health endpoints are small doors into your application, and they should be treated with care.

Health checks exist for automation, but the endpoints they call are usually reachable by other workloads inside the cluster network. A careless health endpoint can leak information or provide an easy way to overload the application. Security thinking for probes is mostly about limiting what they reveal and what they can do.

Reveal as little as possible

A health endpoint should return a simple status, not version numbers, configuration, dependency names, or error details. Those are useful to an attacker exploring your system.

Keep secrets out of probe definitions

Headers or arguments in a probe definition are visible to anyone who can read the pod specification. Do not place passwords or tokens in them.

Do not require authentication that the kubelet cannot provide

A health path behind a login will fail every check. Instead, keep the path simple and separate from protected routes, or use a dedicated port not exposed outside the cluster.

Limit who can reach the endpoint

Use network policies so that only the node agent and necessary internal tools can reach health paths, and never expose them through a public ingress.

Remember command probes run with the container’s privileges

A command probe executes inside the container with its permissions, so keep the command minimal and avoid tools that could be abused if the image is compromised.

Guard against probe abuse

A health endpoint that does heavy work can be used to overload the application by calling it repeatedly. Keep it light, and it stays harmless.

!
Check Your Ingress

A common accident is exposing the whole application, including its health and diagnostic paths, through a public route. Route only the paths meant for users, and keep health endpoints internal.

19Troubleshooting Probes

The cluster records why a probe failed, if you know where to look.

When a pod restarts unexpectedly or never becomes ready, probes are a prime suspect. Fortunately, Kubernetes leaves clear evidence. Each failed probe produces an event on the pod that names the probe type and the reason, such as an unexpected status code, a connection refused, or a timeout. Reading these events is the fastest way to understand what is happening.

1

Describe the pod and read the events

Look for messages saying that a liveness, readiness, or startup probe failed, and read the stated reason. It usually points straight at the cause.

2

Check restart counts and last state

A rising restart count with a last state showing termination after a failed probe confirms that liveness or startup is killing the container.

3

Call the endpoint yourself

From another pod, or from inside the container, request the same path and port that the probe uses. Compare the answer and its timing with what the probe expects.

4

Verify the definition

Check the path, port, scheme, and command. A wrong port number or a path that does not exist is a very common cause, and it fails every time.

5

Compare the timing with reality

Check whether the application really starts and answers within the timeout and threshold you configured, especially on a loaded node.

6

Read the application logs

Logs from before the restart, and from the health handler itself, often show what the application was doing when the checks failed.

SymptomLikely CauseWhat To Do
Restarts shortly after every startLiveness begins before the application is readyAdd a startup probe or lengthen the start-up budget
Connection refused in probe eventsWrong port, or application not yet listeningCheck the port, and use a startup probe for slow starts
Unexpected status code in probe eventsEndpoint returns an error, redirect, or requires loginFix the endpoint or the path, and keep it simple and open
Timeouts under load onlyTimeout too short for a busy applicationIncrease the timeout, lighten the endpoint, use a separate thread or port
Pod stays not ready for a long timeReadiness never passes because of a wrong check or missing dependencyVerify the check and the dependency, and test the endpoint manually
All pods not ready at onceShared dependency in readiness checkRemove or soften the dependency check
Command probe fails inexplicablyTool missing from the image, or command too slowConfirm the tool exists, and make the command light
Rollout stuckNew pods never become readyInvestigate readiness of the new version, and roll back if needed
i
Temporary Debugging Trick

If you cannot tell whether a probe or the application is at fault, temporarily relax the probe in a test environment and observe the application directly. A container that runs fine without the probe and fails with it tells you the probe design is the problem.

20Monitoring and Metrics for Probes

Health checks should be watched, not just trusted.

Probes work quietly in the background, which is exactly why problems with them can go unnoticed for a long time. A pod that restarts once a day because of a slightly too strict liveness probe may never trigger an alarm, yet it steadily degrades user experience. Good monitoring turns probe behaviour into visible numbers and alerts.

Signal 1

Container restart counts

The most important signal. Any steady growth in restarts deserves investigation, since it often means liveness is killing containers.

Signal 2

Ready versus desired pods

A gap between the desired and the ready number of pods shows that readiness is failing somewhere, or that a rollout is stuck.

Signal 3

Probe results per type

The kubelet exposes counters of probe results by type. Rising failure counts reveal flaky or too strict checks before restarts pile up.

Signal 4

Service endpoint counts

The number of endpoints behind each Service should track the number of ready pods. A drop to zero means users are getting errors.

Signal 5

Time to ready after start

Track how long new pods take to become ready. A creeping increase warns that start-up budgets may soon be too small.

Signal 6

Health endpoint latency

Measure how long the health handler takes to answer. If it approaches the timeout, false failures are coming.

flowchart TD
    M[Monitoring system] --> A1[Alert: restarts rising for a workload]
    M --> A2[Alert: ready pods below desired for several minutes]
    M --> A3[Alert: probe failures rising]
    M --> A4[Alert: Service with zero endpoints]
    M --> A5[Alert: rollout not progressing]
    A1 --> R[Investigate probes and application]
    A2 --> R
    A3 --> R
    A4 --> R
    A5 --> R
        
FIG 12 — A small set of alerts covers the ways probes tend to fail
!
Do Not Ignore Small Numbers

A handful of restarts per week seems harmless, but it often points to a real defect or a badly tuned probe. Treat unexplained restarts as bugs to be understood, not as normal background noise.

21Design Patterns for Probes

Reliable arrangements used across many production services.

Pattern: Startup, readiness, and liveness together

Define all three. The startup probe protects slow starts, readiness controls traffic, and liveness detects real deadlocks with a strict but forgiving configuration.

Pattern: Separate endpoints for separate questions

Provide distinct live, ready, and start paths so each can evolve independently, and no single change accidentally alters the meaning of all three.

Pattern: Dedicated health port

Serve health endpoints on a separate port and thread pool, so that a saturated application port cannot block health checks, and health paths are never exposed to users.

Pattern: Cached dependency status

Let a background task check dependencies periodically and store the result. The readiness endpoint reads the stored result, giving fast answers without hammering dependencies.

Pattern: Drain on shutdown

On the shutdown signal, switch readiness to failing, wait briefly, finish in-flight requests, and exit. Combined with a short pre-stop delay, this makes rollouts nearly invisible to users.

Pattern: Heartbeat file for workers

Background workers without a web port write a timestamp to a file as they make progress. A command probe checks that the timestamp is recent, detecting stuck workers without any network endpoint.

flowchart TD
    A[Application] --> H[Health port, separate thread pool]
    H --> L[Live endpoint
process alive and progressing] H --> R[Ready endpoint
reads cached dependency status] H --> S[Start endpoint
initialisation finished] B[Background dependency checker] --> C[Cached status] C --> R
FIG 13 — A dedicated health port with separate endpoints and cached dependency status

22Anti-patterns to Avoid

Habits that turn health checks into a source of outages.

ANTI-PATTERN-01 Avoid
Problem

Making the liveness probe check a database or another external service.

Why It’s Harmful

A dependency outage triggers restarts that cannot fix it, turning a partial problem into a complete outage and a thundering herd on recovery.

Correct Approach

Keep liveness limited to the process’s own health. Put dependency awareness, carefully, in readiness or in the application’s own error handling.

ANTI-PATTERN-02 Avoid
Problem

Using the same endpoint and settings for liveness and readiness.

Why It’s Harmful

Temporary conditions that should only pause traffic instead restart the container, and restarts make the temporary condition worse.

Correct Approach

Use separate endpoints and different sensitivity, with liveness slower and more forgiving than readiness.

ANTI-PATTERN-03 Avoid
Problem

Relying on a huge initial delay instead of a startup probe.

Why It’s Harmful

The delay is always paid, leaves a long blind spot after every restart, and still fails if start-up is slower than expected.

Correct Approach

Use a startup probe with a generous budget and keep the liveness settings tight.

ANTI-PATTERN-04 Avoid
Problem

Leaving out the readiness probe entirely.

Why It’s Harmful

Traffic reaches pods that are still starting, and rolling updates replace healthy pods with broken ones without noticing.

Correct Approach

Define a meaningful readiness probe for every workload that receives traffic.

ANTI-PATTERN-05 Avoid
Problem

Keeping the default one-second timeout under real load.

Why It’s Harmful

Short pauses cause false failures, which lead to flapping readiness or unnecessary restarts.

Correct Approach

Measure real response times under load and set the timeout with a comfortable margin.

ANTI-PATTERN-06 Avoid
Problem

A health endpoint that always returns success.

Why It’s Harmful

Broken pods stay in service and stuck containers are never restarted, so the probe gives false comfort.

Correct Approach

Make the check reflect real ability to make progress or serve, while keeping it cheap.

ANTI-PATTERN-07 Avoid
Problem

Copying probe settings from another service without testing.

Why It’s Harmful

Different applications have different start-up times and response profiles, so copied values are either too strict or too lax.

Correct Approach

Measure and test each application, tune the values, and record the reasons.

23Best Practices and Common Mistakes

A short checklist for dependable health checks.

Best Practices

  • Define readiness for every workload that receives traffic
  • Use a startup probe for slow-starting applications
  • Keep liveness simple, internal, and forgiving
  • Use separate endpoints for liveness, readiness, and start-up
  • Set timeouts and thresholds based on measurements under load
  • Combine readiness with a graceful shutdown and a short pre-stop delay
  • Monitor restarts, ready counts, and probe failures, and alert on them

Common Mistakes

  • Believing that a running pod is a healthy pod
  • Restarting containers because of problems that live elsewhere
  • Forgetting that readiness runs for the whole life of the container
  • Putting a login in front of the health path
  • Ignoring the time a busy application needs to answer
  • Exposing health endpoints publicly
!
Break It on Purpose

Before relying on your probes in production, cause the failures they are meant to handle: a hung process, a slow start, a dependency outage, and a traffic spike. Watching how each probe behaves teaches more than any configuration guide.

24Real-World Scenarios

How teams use, and misuse, probes in daily operations.

A retailer surviving a database blip

A retailer’s liveness probe once checked the database. A brief database failover made every pod fail the check, and all pods restarted at once, taking the site down for minutes. The team changed liveness to check only the process itself, moved dependency awareness into readiness with cached results, and the next failover caused only a short slowdown.

A media company with a slow-starting service

A recommendation service needed four minutes to load models. Its pods were killed in a loop before they could finish. Adding a startup probe with a five-minute budget let the service start reliably, while the liveness probe stayed strict for the rest of its life.

A startup fixing failing rollouts

A startup’s releases sometimes broke production because pods were marked ready as soon as they started. After adding a readiness probe that verified the application could actually serve a test request, bad releases stalled at the first new pod, and the old pods kept serving until the team fixed the issue.

A bank taming a restart storm

During peak trading, a bank’s payment service slowed, its liveness probes timed out, and pods restarted in waves. The team raised the timeout, lightened the health handler, and moved it to a dedicated port and thread pool. Load then caused a brief loss of readiness instead of restarts, and the service recovered on its own.

An operations team finding a silent leak

A dashboard showed a workload restarting three times a day. Nobody had noticed, since users were rarely affected. Investigating showed a slow memory leak, which liveness was accidentally masking by restarting the container. The team fixed the leak instead of living with the restarts.

25Frequently Asked Questions

Q1What is the difference between liveness and readiness?

Liveness asks whether a container is stuck and should be restarted. Readiness asks whether a pod can serve traffic right now, and if not, removes it from Service endpoints without restarting it.

Q2When do I need a startup probe?

When an application takes a long or unpredictable time to start. The startup probe holds back liveness and readiness until start-up completes, so a slow start is not mistaken for a failure.

Q3What happens if I define no probes?

Kubernetes treats a running container as healthy and ready. Traffic reaches pods before they can serve, stuck pods are never restarted, and rolling updates cannot detect broken releases.

Q4Should my liveness probe check the database?

No. A restart cannot fix a database problem, so a liveness check on a dependency causes restart loops and turns a partial outage into a full one. Keep liveness internal to the process.

Q5What do the timing settings mean?

Initial delay is the wait before the first check, period is how often checks run, timeout is how long to wait for an answer, and thresholds are how many consecutive successes or failures change the state. Failure threshold times period sets the reaction time.

Q6How long does an application get to start with a startup probe?

The failure threshold multiplied by the period. For example, thirty failures at ten-second intervals allow up to five minutes. If the application succeeds sooner, the startup probe ends immediately.

Q7Do readiness probes run only at start-up?

No. They run for the whole life of the container, so a pod can become not ready and ready again many times, which is useful for handling temporary trouble.

Q8Which probe mechanism should I use?

Use an HTTP check for web services, gRPC for services that speak it, a TCP check for simple servers, and a command only when nothing else fits, since commands start a process on each check.

Q9Why do my pods restart only under heavy load?

The health check probably becomes slow under load and exceeds its timeout, so liveness fails. Increase the timeout, lighten the endpoint, and consider a dedicated health port and thread pool.

Q10Can a probe help with graceful shutdown?

Yes, indirectly. Failing readiness when draining, together with a short pre-stop delay and proper signal handling, helps traffic move away before the container stops.

Q11Why is my rollout stuck?

Usually because new pods never become ready. Check the readiness probe events and the new version’s behaviour, then fix the cause or roll back.

Q12How do I know if my probes are causing problems?

Watch container restart counts, the gap between ready and desired pods, and probe failure counters, and read probe failure events on the pods. Rising numbers usually point to a probe that is too strict or misdesigned.

26Summary and Key Takeaways

Probes give Kubernetes the ability to look inside a running application and act on what it finds. The liveness probe detects a container that is stuck beyond recovery and restarts it. The readiness probe decides whether a pod may receive traffic, and it can switch on and off throughout the container’s life without any restart. The startup probe protects slow-starting applications by holding the other two back until initialisation is complete.

The power of probes comes with responsibility. A liveness check that depends on external services can turn a small problem into a total outage. A readiness check that is missing lets broken releases replace healthy pods. Timeouts that are too tight cause restart storms under load. Good probe design means separate, cheap, honest endpoints, timing based on measurement, careful treatment of dependencies, graceful shutdown, and monitoring that shows restarts and readiness clearly. Done well, probes make an application self-healing and safe to release. Done badly, they become the cause of the outages they were meant to prevent.

Key Takeaways

  • Each probe answers a different question — liveness decides whether to restart, readiness decides whether to route traffic, and startup decides whether to keep waiting.
  • Readiness is reversible, liveness is not — use readiness for temporary trouble and reserve liveness for truly stuck processes, with forgiving timeouts and thresholds.
  • Never tie liveness to external dependencies — a restart cannot fix a database, and doing so causes cascading restart loops and outages.
  • Use a startup probe for slow applications — its budget of failure threshold times period protects start-up without weakening liveness later.
  • Readiness protects rollouts — without it, Kubernetes cannot tell a broken new version from a healthy one and may replace working pods.
  • Tune from measurements — the default one-second timeout is often too short under load, and copied settings rarely fit another application.
  • Watch and rehearse — monitor restarts, ready counts, and probe failures, and test hangs, slow starts, and dependency outages before production does it for you.