☸️ Understanding Kubernetes Probes

Understanding Kubernetes Probes

Understanding Kubernetes Probes

Kubernetes doesn’t just run your application — it constantly checks if your app is healthy and ready. This is done using Probes.

Probes tell Kubernetes:
Is the app alive?
Is the app ready to receive traffic?
Has the app finished starting?

There are 3 Types of Probes

  • Startup Probe → “Has the app started?”
  • Readiness Probe → “Can it receive traffic?”
  • Liveness Probe → “Is it still alive?”

1. Startup Probe

Startup probe is used when your application takes time to boot.

While startup probe is running, Kubernetes will NOT run readiness or liveness probes.
Pod starts ↓ startupProbe runs ↓ If success → move to readiness If failure → keep retrying
startupProbe:
  httpGet:
    path: /healthz/
    port: 8000
  failureThreshold: 20
  periodSeconds: 15

Best for slow-starting apps (DB connections, migrations, etc.)


2. Readiness Probe

Readiness probe determines if your app is ready to serve traffic.

App starts ↓ readinessProbe runs ↓ If success → Pod marked Ready If failure → Pod NOT used for traffic
readinessProbe:
  httpGet:
    path: /healthz/
    port: 8000
  initialDelaySeconds: 30
  periodSeconds: 15
If readiness fails, Kubernetes removes the pod from service — but does NOT restart it.

3. Liveness Probe

Liveness probe checks if your app is still alive after startup.

App running ↓ livenessProbe runs ↓ If failure → container restarted
livenessProbe:
  httpGet:
    path: /healthz/
    port: 8000
  periodSeconds: 15
If liveness fails, Kubernetes restarts the container.

How All 3 Work Together

Pod starts ↓ startupProbe (only this runs) ↓ startup success ↓ readinessProbe (traffic control) ↓ livenessProbe (health monitoring)

Common Mistakes

  • No startup probe for slow apps
  • Readiness starts too early
  • Health endpoint returns success too soon

Key Lesson

Opening a port does NOT mean your app is ready.

Your health endpoint should only return success when:

  • App is fully initialized
  • Dependencies are ready

  • Startup probe → protects slow startup
  • Readiness probe → controls traffic
  • Liveness probe → restarts unhealthy apps
Think of probes as Kubernetes asking:

"Are you started?"
"Are you ready?"
"Are you still alive?"

Popular posts from this blog

☁️ AWS Global Accelerator (GA) + Route 53

🐳 Docker Filesystem Internals (AdvancEd)

Understanding RabbitMQ Classic Mirrored Queues and Quorum Queues

🐳 Docker Tutorial for Beginners: Step-by-Step with a Simple Example

☸️What’s Inside EKS? A Beginner’s Guide to Its Core Components

☸️ Kubernetes Taints and Tolerations(with Node Affinity)

AWS Load Balancer Controller Upgrade Guide: v2.x to v3.3

🐳 Build a Tiny Flask Web App in Docker (with Ports)

☁️ Amazon S3 Explained: More Than Just Object Storage

☸️ CoreDNS and AWS VPC CNI in EKS