How to set Service Load Balancer request timeouts on GKE

3/28/2018

I have a Service on GKE of type LoadBalancer that points to a GKE deployment running nginx. My nginx has all of the timeouts set to 10 minutes, yet HTTP/HTTPS requests that have to wait on processing before receiving a response get cutoff with 500 errors after 30 seconds. My settings:

http {
    proxy_read_timeout 600s;
    proxy_connect_timeout 600s;
    keepalive_timeout 600s;
    send_timeout 600s;
}

Apparently there are default settings of 30 seconds in the LoadBalancer somewhere.

After pouring through documentation, I've only found a step-through at Google that outlines setting an Ingress with back-end service Load Balancer with a timeout but can't find how to do that on a Service that's Type=LoadBalancer for use with GKE. I've also reviewed all of the Kubernetes documentation for versions 1.7+ (we're on 1.8.7-gke.1) and nothing about setting a timeout. Is there a setting I can add to my yaml file to do this?

If it helps I found the following for AWS, which appears to be what I would need to have on GKE:

  annotations:
    service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: "60"
-- Alex Liffick
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

3/30/2018

So far you cannot do it from the YAML file.

There is a open feature request at the moment that I advise you to subscribe and to follow:

They were already discussing regarding this change in 2016: issue.

"Specific use case: GCE backends are provisioned with a default timeout of 30 seconds, which is not sufficient for some long requests. I'd like to be able to control the timeout per-backend."

However I would suggest you to check this part of the Google Cloud Documentation talking specifically regarding configurable response timeout.

UPDATE Check the issue because they are making progresses

I see there was a v1.0.0 release 18 days ago. Was this the completion of the major refactoring you talked about @nicksardo ? Is it possible yet to configure how long a connection can be idle before the LB closes it? UPDATE The issue mentioned above is now closed and documentation for setting the timeout (and other backend service settings) is available here: https://cloud.google.com/kubernetes-engine/docs/how-to/configure-backend-service

-- GalloCedrone
Source: StackOverflow