Keyboard Shortcuts N Next post
P Previous post
S Save / unsave
R Read aloud
T Toggle theme
/ Focus search
Esc Close panels
🔥
Ready to read...
Health K8s Pods Kubernetes Kubernetes: From Zero to Production Module 3 - Pods and Workloads

Pod Lifecycle, Liveness, and Readiness Probes

Reviewed & accurate
AI Summary

What You Will Learn

Intermediate

  • Pod lifecycle phases
  • Three types of probes
  • How to configure them

Three Probe Types

ProbeWhat it checksFailure action
LivenessIs the app alive?Restart container
ReadinessIs the app ready to serve?Remove from Service (no traffic)
StartupHas the app started?Restart (for slow-starting apps)
probes.yamlyaml
apiVersion: v1
kind: Pod
metadata:
  name: my-app
spec:
  containers:
  - name: app
    image: my-app:latest
    livenessProbe:
      httpGet:
        path: /health
        port: 8080
      initialDelaySeconds: 15
      periodSeconds: 10
    readinessProbe:
      httpGet:
        path: /ready
        port: 8080
      initialDelaySeconds: 5
      periodSeconds: 10
    startupProbe:
      httpGet:
        path: /startup
        port: 8080
      failureThreshold: 30
      periodSeconds: 10
Liveness vs Readiness
Liveness = should I RESTART you? Readiness = should I SEND TRAFFIC to you? An app can be alive but not ready (still loading data).

Practical Exercise

Add livenessProbe to a Pod YAML (HTTP GET /health)
Add readinessProbe (HTTP GET /ready)
Apply and check: kubectl describe pod
Simulate failure: make /health return 500
Watch: K8s restarts the container

Key Takeaways

  • Liveness: app alive? If not, RESTART container.
  • Readiness: app ready? If not, REMOVE from Service (no traffic).
  • Startup: app started? For slow-starting apps (JVM, etc).
  • Probe types: httpGet, tcpSocket, exec.
  • initialDelaySeconds: wait before first probe.
Previously: Lesson 18 covered Jobs.
Today: You learned: Health checks: liveness, readiness, startup probes.
Next: Module 3 complete! Module 4 begins with lesson 20.
Test Your Knowledge
How did you find this?

Comments

Join the discussion! Sign in with your Google or Blogger account, or comment as Anonymous - no account needed. For quick questions, also reach me on Telegram @cytestch.

Comments