Lab โ Full SRE Drill¶
Difficulty: Advanced ยท Estimated time: 90-120 min
A complete hands-on simulation of an SRE shift, combining detection, triage, mitigation, resolution, and postmortem โ all in one exercise.
๐ฏ Objective¶
- Detect an outage via monitoring
- Investigate using Linux & Kubernetes tools
- Fix a broken container image
- Redeploy the service to Kubernetes
- Verify recovery in dashboards
- Complete a postmortem
๐ Lab Setup¶
Prerequisites¶
- Kubernetes cluster (minikube, kind, or cloud)
kubectl,docker, andhelminstalled- Prometheus + Grafana from Monitoring & Alerting Lab
- Sample app
hellofrom Linux/Docker/K8s Challenges
๐ฆ Step 1 โ Start Healthy State¶
- Ensure
helloapp is running version1.0:kubectl set image deployment/hello hello=ghcr.io/<your-org>/hello:1.0 kubectl rollout status deployment hello - Confirm readiness:
kubectl get pods -l app=hello curl http://<hello-service-ip>:8080
๐จ Step 2 โ Trigger a Failure¶
Simulate a bad deploy:
kubectl set image deployment/hello hello=ghcr.io/<your-org>/hello:broken
๐ Step 3 โ Detect & Triage¶
From Monitoring¶
- Open Grafana Error Rate Dashboard.
- See
HighErrorRatealert firing in Alertmanager.
From CLI¶
kubectl get pods -l app=hello
kubectl describe pod <pod-name>
kubectl logs <pod-name> --tail=50
kubectl rollout history deployment hello
๐งฎ Step 4 โ Investigate Locally (Linux & Docker)¶
- Pull broken image locally:
docker pull ghcr.io/<your-org>/hello:broken - Run it:
docker run --rm -p 8080:8080 ghcr.io/<your-org>/hello:broken - Observe logs and identify issue (e.g., missing dependency, syntax error).
- Fix code locally and rebuild:
docker build -t ghcr.io/<your-org>/hello:1.1 . docker push ghcr.io/<your-org>/hello:1.1
๐ Step 5 โ Mitigation in Kubernetes¶
Rollback quickly to restore service:
kubectl rollout undo deployment hello
kubectl get pods -l app=hello
curl http://<hello-service-ip>:8080
๐ Step 6 โ Deploy Fixed Version¶
Deploy new working image:
kubectl set image deployment/hello hello=ghcr.io/<your-org>/hello:1.1
kubectl rollout status deployment hello
๐ Step 7 โ Verify Recovery¶
- Check Grafana dashboard โ error rate returns to 0
- Alert in Alertmanager transitions to Resolved
kubectl get podsshows all pods Running
๐งพ Step 8 โ Postmortem¶
Example Template: | Section | Details | |----------------|---------| | Incident | SEV-1 โ Hello app outage | | Impact | All requests failing with HTTP 500 for 7 min | | Start | 14:03 UTC | | End | 14:10 UTC | | Root Cause | Bad image pushed without health checks | | Mitigation | Rolled back to last known good version | | Fix | Rebuilt image with missing dependency | | Action Items | Add CI build tests, enable canary deployments |
๐งช Bonus Drills¶
Drill 1 โ Dependency Failure¶
- Deploy a fake
apiservice thathellodepends on. - Kill the
apideployment. - Triage and resolve by redeploying
api.
Drill 2 โ Resource Starvation¶
- Set very low CPU/memory limits.
- Watch pods get OOMKilled.
- Fix by increasing resource requests/limits.
Drill 3 โ Network Isolation¶
- Apply restrictive NetworkPolicy to block DB access.
- Observe failures.
- Roll back NetworkPolicy.
โ Success Criteria¶
- [ ] Detected the failure via monitoring
- [ ] Investigated with both CLI & dashboards
- [ ] Mitigated quickly via rollback
- [ ] Deployed fixed version without downtime
- [ ] Verified recovery in Grafana/Alertmanager
- [ ] Completed postmortem with actionable follow-ups
A full SRE shift means juggling detection, response, and long-term fixes โ this drill gives you that muscle memory.