Chaos experiments (pod kill, network latency, network partition) against a sample app on Kubernetes using Chaos Mesh, with runbooks and scheduled experiment support. Demonstrates a production-grade chaos-engineering workflow: define → run → observe → clean up → schedule.
chaos-engineering-toolkit/
├── experiments/
│ ├── pod-kill/ # PodChaos – kills one API pod randomly
│ │ ├── experiment.yaml
│ │ └── schedule.yaml # runs every 10 min
│ ├── network-latency/ # NetworkChaos – 200 ms ± 50 ms on API egress
│ │ ├── experiment.yaml
│ │ └── schedule.yaml # runs every 6 h
│ └── network-partition/ # NetworkChaos – severs API ↔ DB for 30 s
│ ├── experiment.yaml
│ └── schedule.yaml # runs weekly (Mon 02:00)
├── sample-app/
│ ├── manifests/ # Namespace, Deployment (3 replicas), Service, HPA
│ └── src/ # Flask API with /health and /ready probes + Dockerfile
├── runbooks/ # Step-by-step guides for each chaos scenario
├── scripts/ # setup.sh, run-experiment.sh, check-steady-state.sh
└── tests/ # pytest: validates YAML schemas for experiments + K8s manifests
| Tool | Version |
|---|---|
| kubectl | ≥ 1.28 |
| helm | ≥ 3.14 |
| kind or k3d (local cluster) | any recent |
| Python | ≥ 3.11 (for tests/linting) |
kind create cluster --name chaos-demomake setupThis runs scripts/setup.sh, which:
- Adds the Chaos Mesh Helm chart
- Installs Chaos Mesh in the
chaos-testingnamespace - Applies the sample-app Kubernetes manifests
- Waits for the
demo-apideployment to roll out
make check-steady-statemake experiment EXP=pod-kill
# or
make experiment EXP=network-latency
# or
make experiment EXP=network-partitionThe script applies the experiment, polls status, and cleans up on expiry.
kubectl apply -f experiments/pod-kill/schedule.yaml
kubectl apply -f experiments/network-latency/schedule.yaml
kubectl apply -f experiments/network-partition/schedule.yamlWhat: Kills one randomly chosen demo-api pod.
Duration: 60 s (Kubernetes reschedules within ~15 s).
SLO impact: Available replicas must stay ≥ 2; success rate ≥ 99 %.
What: Adds 200 ms ± 50 ms latency to all outbound traffic from demo-api.
Duration: 120 s.
SLO impact: p99 latency rises ~200 ms; circuit breakers must not open.
What: Completely severs bidirectional traffic between demo-api and demo-db.
Duration: 30 s.
SLO impact: DB-dependent endpoints return 503; no data corruption.
See the runbooks/ directory for detailed step-by-step guides.
make install # pip install -r requirements-dev.txt
make validate # yamllint + pytestTests validate:
- All experiment YAML files parse correctly and have required Chaos Mesh fields
- All Kubernetes manifests have required fields, probes, and resource limits
- Chaos Mesh 2.6 — Kubernetes-native chaos engineering platform
- Kubernetes — Deployment, Service, HPA for the sample app
- Flask 3 — Minimal demo API with health/readiness probes
- pytest + PyYAML — YAML schema tests
- yamllint — YAML linting
- GitHub Actions — CI: lint + test on every push