GKE Ingress: 502 error when downloading file

3/28/2018

I have cluster deployed at GKE and exposed with Ingress. Static resources and majority or REST requests works fine. But i got 502 Server Error on download file request. Error message is: The server encountered a temporary error and could not complete your request.Please try again in 30 seconds.

Without Ingres, when LoadBalancer is used instead, download works fine. I suspect Ingress don`t like backend response. Here is success response headers(without Ingress):

HTTP/1.1 200 OK
transfer-encoding: chunked
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE
Access-Control-Max-Age: 3600
Access-Control-Allow-Headers: x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Transfer-Encoding: chunked
Date: Wed, 28 Mar 2018 13:55:39 GMT

What i have tried:

  1. Increase backend service timeout for ingress forwarding rule in cloud console from default 30 sec to 100 sec
  2. Search stackdriver logs - didn`t found any logs for Ingress controller.

Why this request don`t work with Ingress, how fix it? Where can i find logs for Ingress in GKE?

-- Zufar Muhamadeev
google-cloud-platform
google-kubernetes-engine
kubernetes-ingress

2 Answers

3/20/2020

I had the same problem when my request to the server (through Ingress) when the call exceeded 30 seconds, which is the default timeout for backend services in GKE.

I know this is an old issue, so my answer here is just for future Googlers.

You write that you have increased the timeout which did not fixed the bug. Be aware that the timeout increase in the backend services does need some time to take effect. Someplace I read that it could take up to 20 minutes.

So if you still get the 502 error at exactle 30 seconds into the call, the issue is probably still caused by the backend service in GCP that reaches the timeout - so just wait 20 minutes and try again.

-- thephper
Source: StackOverflow

4/1/2018

As far as I know there is no specific logs for the ingress, but you can check the ingress status and details:

kubectl get ingress

kubectl describe ingress [YOUR INGRESS]  

Then check which is the configured backend pod and check the logs there.

kubectl logs [BACKEND POD NAME]
-- Jordi Miralles
Source: StackOverflow