Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes: How to change the default timeout of 60 sec of the AWS Load Balancer when exposing a service?

Exposing a service with --type="LoadBalancer" in AWS currently creates a TCP-level AWS ELB with the default timeout of 60 sec. Is there a way to change that timeout other than manually looking up the load balancer and reconfiguring it using AWS tools? (I.e. the laborious kubectl describe service xyz | grep "LoadBalancer Ingress" -> use AWS API to lookup the load balancer with this URL and set its timeout) Or are the good alternatives to using this automatically created ELB?

The problem with the current situation is that (1) 1 min is too short for some of our services and (2) due to load-balancing on the TCP (and not HTTP) level, the client does not get an informative error when the timeout is reached (in the case of curl: "curl: (52) Empty reply from server")

Thank you!

like image 816
Jakub Holý Avatar asked May 02 '16 13:05

Jakub Holý


1 Answers

It's possible to set connection idle timeout for ELB in the recent Kubernetes versions (1.4 or later?) using an annotation on the service. For example:

kubectl annotate service my-service service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout=1200

Also, you can change the load balancing protocol to HTTP with the below annotation.

service.beta.kubernetes.io/aws-load-balancer-backend-protocol

See the AWS provider source for more annotations for AWS ELB.

like image 189
Buchi Avatar answered Oct 19 '22 09:10

Buchi