Skip to content

Module 7: Self-Healing & Probes

๐Ÿ—๏ธ 1. The Manual Task: Custom Watchdog Scripts

In a manual infrastructure, sysadmins used to write scripts to check if their application was still running.

The Manual Steps:

  1. Write Health Checks: Bash scripts that โ€œpingโ€ an endpoint (e.g., curl localhost:8080/health).
  2. Monitor Health: Scripts that run on a cron schedule and run systemctl restart if the app fails.

๐Ÿฉบ 2. The Kubernetes Abstraction: Probes & ReplicaSets

Kubernetes provides built-in self-healing mechanisms at both the Container and Pod level.

  • Liveness Probes: โ€œIs the app deadlocked?โ€ If yes, Kubernetes kills and restarts the container.
  • Readiness Probes: โ€œIs the app ready for traffic?โ€ If no, the Service stops sending you requests.
  • ReplicaSet Controller: If a whole node dies, it automatically restarts the Pods on a healthy node.