Lab โ Incident Response Simulation¶
Difficulty: Intermediate ยท Estimated time: 45-60 min
Simulate a real-world production incident and practice the full response process: detect โ triage โ mitigate โ resolve โ review.
๐ฏ Objective¶
Work through a simulated outage to: - Identify the issue from monitoring and logs - Communicate effectively with the team - Apply a quick mitigation - Perform a safe resolution - Write a postmortem
๐ Lab Setup¶
Prerequisites¶
- Kubernetes cluster (minikube, kind, or cloud)
kubectlCLI access- Sample app deployed from Lab 6 โ Deploy an App
Simulated Service¶
Weโll use the hello app from previous labs and introduce a failure.
๐งจ Step 1 โ Deploy the Healthy App¶
Deploy version 1.0:
kubectl apply -f deployment.yaml
kubectl rollout status deployment hello
kubectl get pods -l app=hello
๐จ Step 2 โ Simulate an Incident¶
Edit deployment.yaml to use a broken image:
image: ghcr.io/<your-org>/hello:broken
kubectl apply -f deployment.yaml
Expected outcome: - Pods crashloop - Probes fail - Error rate spikes
๐ Step 3 โ Detection¶
Metrics:
- Use kubectl top pods (CPU/mem anomalies)
- Check Grafana dashboards (if integrated)
- Run PromQL for error rate:
sum(rate(http_requests_total{status!~"2.."}[5m]))
Logs:
kubectl logs -l app=hello --tail=50
๐งฎ Step 4 โ Triage¶
Answer: 1. Scope โ Which namespaces/services are impacted?
kubectl get pods --all-namespaces | grep -i crash
kubectl get events --sort-by=.lastTimestamp | tail
๐ Step 5 โ Mitigation¶
Rollback to last working version:
kubectl rollout undo deployment hello
kubectl rollout status deployment hello
Scale up temporarily to handle backlog:
kubectl scale deployment hello --replicas=5
๐ Step 6 โ Resolution¶
Confirm:
kubectl get pods -l app=hello
kubectl logs -l app=hello | tail
curl -I http://<service-ip>:8080
๐งพ Step 7 โ Postmortem¶
Use the Postmortem Template and record: - Incident title, severity - Impact metrics - Root cause - Timeline - Actions to prevent recurrence
๐งช Bonus Challenge¶
1. Break a Dependency¶
- Deploy a second service (
api) thathellodepends on. - Stop the
apideployment and observe the impact onhello.
2. Network Failure¶
- Apply a restrictive NetworkPolicy that blocks
hellofrom talking toapi. - Diagnose using
kubectl describe networkpolicy.
3. Pod Resource Starvation¶
- Set very low CPU/memory limits in the deployment.
- Watch pods get OOMKilled and fix by adjusting resources.
โ Success Criteria¶
- [ ] Detected the issue via metrics/logs
- [ ] Determined scope & severity
- [ ] Applied a safe rollback or mitigation
- [ ] Verified full recovery
- [ ] Completed a postmortem with actionable follow-ups
Incidents are a matter of โwhen,โ not โif.โ Practicing the process is what makes you reliable under pressure.