Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 15/ 160
01. Kubernetes Fundamentals & Architecture

Liveness, Readiness & Startup Probes

Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods.

IntermediateLiveness · Readiness · Startup3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Readiness is a restaurant hostess deciding when to seat guests, liveness is the fire alarm, and startup is the grace period while the kitchen turns on. The simple Kubernetes rule is: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Think of it like…

Readiness is a restaurant hostess deciding when to seat guests, liveness is the fire alarm, and startup is the grace period while the kitchen turns on.

Where you’ve seen it

A cluster operator validates a small change and runs kubectl describe pod api-0; kubectl get endpoints api -o yaml. Expected evidence: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy. If the run instead shows this symptom, stop and restore the last known state: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.

Words you’ll hear

Liveness
For this lesson, Liveness is the controlling idea: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
Readiness
Readiness is the checkpoint; run kubectl describe pod api-0; kubectl get endpoints api -o yaml and inspect the owner chain. A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.
Startup
Startup is the outcome to preserve; the cost is explicit: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.
Verification evidence
The evidence command is kubectl describe pod api-0; kubectl get endpoints api -o yaml. It connects the declaration to this behavior: Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Liveness reaches the intended state

Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods. Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

The concrete checkpoint is kubectl describe pod api-0; kubectl get endpoints api -o yaml; compare the Liveness owner, Readiness state, and Startup outcome instead of treating YAML acceptance as proof.

Verify Readiness, not only object creation

Run kubectl describe pod api-0; kubectl get endpoints api -o yaml after the change and correlate the result with Events and the owning object. Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Key takeaway: Liveness is implemented only when this invariant remains observable: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Readiness: failure boundary and production cost

A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts. The prerequisite contract is concrete: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity. A safe design limits blast radius, records the last good configuration, and uses kubectl describe pod api-0; kubectl get endpoints api -o yaml as a deterministic rollback checkpoint.

Recover from Readiness drift

Capture the current state with kubectl describe pod api-0; kubectl get endpoints api -o yaml, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.

Key takeaway: Accept the trade-off consciously: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

How it works, step by step

Step 1 of 4
Operator intent

1. Model the cluster contract

Start from a minimal API, context, or node condition and make this contract explicit: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Liveness contract → owned state
Key numbers at this step
Goal
Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods.
Owner
Liveness

When to use it & trade-offs

What it is

Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods. Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Why it matters: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts. The invariant at risk is specific: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy. The quickest fact check before changing the design is kubectl describe pod api-0; kubectl get endpoints api -o yaml.

When to reach for it

  • Use Liveness to enforce this invariant: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
  • Use Readiness evidence from kubectl describe pod api-0; kubectl get endpoints api -o yaml in reviews and incident timelines. Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods.
  • Choose the platform-level abstraction route only when this cost is justified by governance or scale: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

When to avoid or be careful

  • Avoid assuming Liveness is complete after YAML submission; the required behavior is concrete: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
  • Avoid treating the next symptom as random; check the owner and state with kubectl describe pod api-0; kubectl get endpoints api -o yaml first: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

Native, manual, and managed paths for Liveness

Native cluster primitive
Best for: Configure probes so Kubernetes restarts unhealthy containers and routes only ready pods. A concrete incident check is kubectl describe pod api-0; kubectl get endpoints api -o yaml.

Strengths: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Watch out: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity. Recovery must also recognize this signal: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.

One-off administrative action
Best for: Quickly testing the Readiness assumption with kubectl describe pod api-0; kubectl get endpoints api -o yaml; the expected invariant is: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Strengths: kubectl describe pod api-0; kubectl get endpoints api -o yaml gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Liveness, it does not make this symptom self-documenting: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.

Platform-level abstraction
Best for: Teams that need Startup integrated with guardrails; the evidence path is kubectl describe pod api-0; kubectl get endpoints api -o yaml.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.

Watch out: The added platform ownership buys value at this cost: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
  • Trace Liveness to Startup through Readiness; the invariant is: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
  • Recognize the symptom: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.
  • Justify the cost: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.
  • Verify with kubectl describe pod api-0; kubectl get endpoints api -o yaml instead of only inspecting YAML.

Benchmarks & rules of thumb

3 -
probe kinds: startup, readiness, and liveness
3 -
default failureThreshold for probe definitions
10s -
default probe period unless the workload overrides it

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Liveness owner contract: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy.
  • Ignoring this telltale condition leads to unrelated changes: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts.
  • Repeating kubectl describe pod api-0; kubectl get endpoints api -o yaml without an owner for remediation wastes retry cost. Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy?
  • Which owner object, logs, and Events would you inspect for this symptom-A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts-?
  • At what threshold would this cost become unacceptable: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity?
Interview tip: Interview sequence: state the invariant, run kubectl describe pod api-0; kubectl get endpoints api -o yaml, name the failure, then justify the cost. Invariant: Readiness removes a Pod from Service endpoints, liveness restarts a stuck container, and startup suppresses the other two until a slow-starting process has had time to become healthy. Failure: A liveness dependency check can restart an otherwise healthy app during a downstream outage, while a missing startup probe can kill a JVM or migration-heavy process before it starts. Cost: Probes make traffic and recovery automatic, but over-aggressive thresholds create cascades and probe endpoints consume application capacity.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Liveness, Readiness & Startup Probes with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Resource Requests & Limits (CPU millicores, Memory Mi/Gi, QoS Classes)
Next topic
Pod Termination Lifecycle, preStop Hooks & Graceful Shutdown