# On-Call Runbook: Service returns 503 on primary endpoint## SummarySymptom: HTTP 503 responses from https://api.example.com/ (primary endpoint). Likely causes: overloaded backend, unhealthy service, misconfigured LB, or upstream dependency failure.## Immediate Actions (mitigate impact)- Acknowledge alert in PagerDuty.- Enable maintenance mode / serve degraded cached responses if available.- Add throttling / scale up if autoscaler exists.- Notify downstream teams and update status page.Example:bash
# ack PagerDuty (CLI)
pd-severity ack INCIDENT_ID --note "Taking ownership"
# enable maintenance page (nginx example)
ssh ops@loadbalancer && sudo cp /etc/nginx/maintenance.conf /etc/nginx/sites-enabled/default && sudo nginx -s reload
## Diagnostics (commands & checks)- Check service pods/instances:bash
kubectl get pods -n production -l app=api -o wide
kubectl logs deployment/api -n production --tail=200
kubectl describe pod <pod> -n production
- LB / healthchecks:bash
curl -I https://api.example.com/health
ssh lb && sudo tail -n 200 /var/log/nginx/error.log
- Check metrics and errors:bash
# check recent 5xx in monitoring (example with prometheus API)
curl -g 'https://prometheus/api/v1/query?query=sum(rate(http_requests_total{job="api",status=~"5.."}[5m]))'
- Check dependencies (DB, downstream services):bash
pg_isready -h db-primary.example.com -p 5432
curl -I https://auth.example.com/health
## Root-cause quick checks- Confirm if 503 originates at LB (gateway) or app.- If LB returns 503: inspect config and upstream backend health.- If app returns 503: inspect recent deployments, OOM, CPU spikes.## Rollback Steps & Verification- If caused by recent deploy, rollback to last stable tag:bash
# Kubernetes rollback
kubectl rollout undo deployment/api -n production --to-revision=<stable_rev>
kubectl rollout status deployment/api -n production
- Scale up/down:bash
kubectl scale deployment/api -n production --replicas=5
- Verify:bash
curl -I https://api.example.com/health
curl -s https://api.example.com/ | head -n 20
# check metrics for 5xx dropping
## Owner & Escalation- Primary on-call: oncall-sre@example.com (PagerDuty)- Service owner: alice.engineer@example.com, +1-555-0101- Backend lead: bob.backend@example.com, +1-555-0102- Escalation (after 15 min): SRE Lead (sre-lead@example.com), Engineering Manager (eng-mgr@example.com)## Postmortem / Next Steps- Document timeline, root cause, and remediation in incident tracker.- Create follow-up TODOs (tests, alerts tuning, automation) and assign owners.