Overview
Kubernetes is the most common target for chaos engineering. Tools can inject faults at the Pod, Node, or Network layer to ensure your cluster configuration handles failures correctly.
Common Kubernetes Chaos Scenarios
- Pod Kill: Randomly terminate pods to test self-healing (ReplicaSets/Deployments).
- Network Partition: Simulate a network outage between microservices.
- Node Drain: Simulate a node maintenance event or failure.
Example: Simulating a Pod Failure
Using LitmusChaos to terminate a pod in the default namespace.
# Apply a pod-delete experiment
kubectl apply -f litmus-pod-delete.yamlExpected Result: The Pod is deleted, and Kubernetes should immediately schedule a new one.
Experiment: pod-delete
Status: RUNNING
Action: Pod nginx-pod deleted.
Observation: Kubernetes scheduler created new Pod nginx-pod-abc12.
Experiment Status: PASSED