What is Self-Healing?
Self-Healing is a Kubernetes feature that automatically detects failed Pods or containers and restores the desired state by restarting or recreating them.
Why Do We Need Self-Healing?
Suppose you have 3 Pods running:
Pod-1
Pod-2
Pod-3
If Pod-2 crashes:
Pod-1
Pod-2 (Failed)
Pod-3
Kubernetes automatically creates a new Pod:
Pod-1
Pod-3
Pod-4 (New)
This will ensures the desired number of Pods is always maintained.
How Self-Healing Works
Deployment
|
ReplicaSet
|
3 Pods
|
Pod Crashes
|
ReplicaSet Detects Failure
|
New Pod Created Automatically
Practical Demo
Check running Pods - kubectl get pods
Delete one Pod manually - kubectl delete pod <pod-name>
Check again - kubectl get pods
You will see Kubernetes automatically creating a new Pod.
Benefits
High Availability
Reduced Manual Intervention
Automatic Recovery
Better Reliability
Continuous Application Availability
No comments:
Post a Comment
testing