Through Istio, clients get "503 upstream connect error or disconnect/reset before headers. reset reason: connection failure".
IntermediateTroubleshooting5xx errors
Answer
Likely causes → Envoy couldn't connect to the destination pod: the pod is gone but Envoy's endpoint list is stale, mTLS mode mismatch (STRICT on server, client without sidecar), the app listens on localhost only, or the port name/protocol is wrong.
Diagnose →
istioctl proxy-config endpoints deploy/frontend -n prod | grep orders
istioctl analyze -n prod
kubectl get peerauthentication -A
kubectl logs deploy/frontend -c istio-proxy -n prod | grep ' 503 ' | head
The response flags in Envoy access logs (UF, URX, UH) tell you which failure it was.
Fix → Align mTLS policy, have the app bind 0.0.0.0, fix port naming (http-, grpc-), and add a modest retry on connect-failure in the VirtualService.
Prevent → Run istioctl analyze in CI, and roll mTLS STRICT out per namespace with PERMISSIVE first.
More on 5xx errors
Right after a release, 500s spike to 8% and logs show `java.lang.NullPointerException` in a new code path.BeginnerLong-running report exports fail with "504 Gateway Time-out" from the ALB at exactly 60 seconds.Beginnernginx logs "upstream prematurely closed connection while reading response header from upstream" and users get 502.IntermediateEvery deploy causes 10–20 seconds of 502s from the ALB, even with a rolling update.IntermediateA Node.js service behind an ALB returns a steady trickle of 502s under normal load, with no app errors at all.AdvancedAPI Gateway returns "502 Bad Gateway" and the logs say "Execution failed due to configuration error: Malformed Lambda proxy response".Beginner