Suppose a deployment runs six copies of an HTTP API. The shared database stalls. All six copies fail the same health check, Kubernetes restarts them, and now the database has six cold clients trying to reconnect. The restart count is easy to see. The service is harder to recover than it was before the first restart.
Design each probe around the action its failure triggers. In Kubernetes, a readiness failure can take a Pod out of normal Service routing. A liveness failure can restart the container. A startup probe lets slow initialization finish before readiness and liveness checks begin. Write down the expected action for each failure before you decide what an endpoint should inspect. Kubernetes probe documentation
What should each endpoint know?
Consider a fictional catalog API with two routes. Product details come from an in-process snapshot that stays usable for a bounded period. Live inventory needs the database. The API can still answer product requests during a database outage and return an explicit unavailable response for inventory. Losing all endpoints would throw away the part of the service that still works.
- Startup checks whether the server has initialized the local machinery it needs, including the request executor. Initialization is bounded. Loading a usable snapshot is part of readiness in this example.
- Readiness checks whether the executor is making progress, the instance has a usable snapshot, and the server can accept new work. Fail if initialization of that snapshot has yet to complete, the snapshot has aged past its permitted window, or the instance has begun draining. Read a local readiness state that the refresh loop updates.
- Liveness checks whether the process can still make meaningful local progress. An endpoint on an independent management thread can return 200 while the request executor is deadlocked. If the HTTP handler runs separately, have it read a watchdog updated by the executor itself. Use a deadline that allows healthy work to complete.
The database gets its own availability signal. The inventory route can return a bounded error and the team can alert on the failed dependency. Keep the probe cheap, including during failure. A fresh query from every Pod on every health request adds load to the same database that is trying to recover. For per-request timeouts, retries, and fallback behavior, see what happens when a service dependency fails.
A service with a hard dependency may have a different readiness contract. If it cannot serve any useful request without that dependency, failing readiness can make sense. Know what clients see when the last ready endpoint disappears, how you will detect that state, and how probes recover when the dependency does. Liveness still needs a reason to restart this specific container.
Configure for the service you actually have
This fragment goes under the catalog container in the Pod template. The application supplies the three paths on port 8080 and returns a successful status only when the corresponding check passes. The numbers are examples to tune against observed startup time, traffic requirements, and the delay you can accept before taking action.
startupProbe:
httpGet: {path: /startupz, port: 8080}
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 24
readinessProbe:
httpGet: {path: /readyz, port: 8080}
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 2
successThreshold: 2
livenessProbe:
httpGet: {path: /livez, port: 8080}
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
That startup configuration gives the process roughly two minutes of failed checks before Kubernetes can restart it. Its first success hands off to the other probes. The readiness success threshold requires consecutive successes after a failure, giving a jittery instance a little time to settle. A liveness restart takes multiple failures so a brief scheduling stall has room to clear. These settings describe probe behavior. Clients see additional delays from routing updates, termination, and reconnection.
Choose your numbers from measurements. If slow but healthy starts sometimes take 90 seconds, test the configuration under the same conditions that produced that number. Include cold starts after a deployment and starts on busy nodes. If the probe itself waits behind an unbounded request queue, fix that queue or make the check less sensitive to ordinary load. Otherwise a burst can look like a process failure and removing capacity makes the burst worse.
Exercise the failure paths
Run the scenario against a staging Service with multiple replicas. Watch Pods with kubectl get pods -l app=catalog -w and EndpointSlices with kubectl get endpointslice -l kubernetes.io/service-name=catalog -o yaml. Inspect each endpoint's readiness condition and match it to its Pod. Use kubectl describe pod POD_NAME to correlate probe events and restart counts. Keep a timestamped request log from a client using the Service, with the responding Pod recorded in staging logs so you can tell where the requests went.
| Injected fault | Routing | Restart |
|---|---|---|
| Slow startup | Wait for readiness | Only if startup exceeds its budget |
| Local deadlock | Withdraw the affected Pod | Restart its container |
| Database outage | Serve usable snapshot data | None for the outage itself |
For slow startup, stretch initialization within the budget and verify the container starts once. Watch for a gap between the startup probe succeeding and the first successful routed request if the snapshot takes longer to load. Also try a start that exceeds the budget so you can distinguish a legitimate restart from readiness simply staying false.
For a local deadlock, stop progress in one staging replica's request executor using a test hook. Verify the health code actually observes the executor. In this example, readiness should also use the local progress signal to withdraw the Pod before the slower liveness threshold fires. Watch the other replicas handle new connections, then confirm the repaired container rejoins only once it can serve. Existing keep-alive connections and already accepted requests deserve their own check. Readiness does not finish those requests for you. Use the graceful shutdown guide to plan how the application drains.
For a database outage, test the inventory error path and a product request while the snapshot is still usable. Run the fault long enough to exercise snapshot expiry, too. Confirm the service stops offering stale data beyond its contract and restarts do not climb. Restore the database and verify the refresh loop can reload the snapshot, the endpoint returns to routing, and inventory requests work again. Observe the client throughout recovery. A Pod condition turning green is only part of the evidence.
Put the expected action beside each probe in the service runbook. The next person on call should be able to tell whether a failing check calls for removing traffic, restarting a container, or fixing a dependency the entire fleet is waiting on.