Interview Prep/SRE & Reliability/Reliability Patterns in Production

Every rolling deploy produces a short burst of 502s on the AWS ALB.

IntermediateTroubleshootingReliability Patterns in Production
Answer

Likely causes → Pods terminate before the ALB stops sending traffic: no preStop delay, app exits immediately on SIGTERM, or deregistration delay is longer than terminationGracePeriodSeconds. ALB access logs show elb_status_code 502 with target_status_code -.

Diagnose →

kubectl get deploy checkout -n shop -o yaml | yq '.spec.template.spec | {grace: .terminationGracePeriodSeconds, lifecycle: .containers[0].lifecycle}'
kubectl get ingress -n shop checkout -o yaml | grep -i deregistration

Fix → Add preStop: sleep 15, handle SIGTERM gracefully, set terminationGracePeriodSeconds above preStop plus drain time, and align the target group deregistration_delay.timeout_seconds. With the AWS Load Balancer Controller, enable pod readiness gates.

Prevent → Run a pod-kill chaos experiment under load after any change to deployment settings.

All SRE & Reliability questions

More on Reliability Patterns in Production