Applications migrated from ingress-nginx to Istio Service Mesh using the Kubernetes Gateway API (HTTPRoute) may experience intermittent HTTP 502 or 504 errors. This article provides steps to determine if the error originates from the Istio Gateway or the backend upstream service.
Symptoms:
via_upstream flag.HTTPRoute)The errors are typically returned by the backend application (upstream) rather than the Istio Gateway itself. When Istio logs indicate via_upstream, it signifies the proxy received the error from the backend service and passed it to the client. Misaligned timeout values or backend service crashes during migration often cause these symptoms.
Identify the Source of the Error: Examine the istio-proxy logs for the gateway pod:
If the log entry contains via_upstream, the backend service is generating the error.
Analyze Backend Logs: Correlate the timestamp from the Istio log with the specific backend pod logs identified in the HTTPRoute mapping.
Check Timeout Alignment: Ensure that the Istio Gateway timeouts are not shorter than the backend application response times.
Verify Topology: Confirm if any external Load Balancers or Proxies sit in front of the Istio Gateway that might be timing out before Istio processes the request.