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:
- Write Health Checks: Bash scripts that โpingโ an endpoint (e.g.,
curl localhost:8080/health). - Monitor Health: Scripts that run on a
cronschedule and runsystemctl restartif 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.