LoadBalancer Services allow you to configure timeout, which is the maximum duration for keeping a connection if no request is received from the client. If no request is received during this period, the load balancer closes the connection and establishes a new one with the client when the next request arrives.
Timeout Type |
Load Balancer Type |
Restrictions |
Supported Cluster Version |
---|---|---|---|
Idle timeout |
Dedicated |
None |
|
Idle timeout |
Shared |
UDP is not supported. |
|
Request timeout |
Dedicated and shared |
Only HTTP and HTTPS are supported. |
|
Response timeout |
Dedicated and shared |
Only HTTP and HTTPS are supported. |
Configuration |
Description |
Restrictions |
---|---|---|
Idle Timeout |
Timeout for an idle client connection. If there are no requests reaching the load balancer during the timeout duration, the load balancer will disconnect the connection from the client and establish a new connection when there is a new request. |
This configuration is not supported if the port of a shared load balancer uses UDP. |
Request Timeout |
Timeout for waiting for a request from a client. There are two cases:
|
This parameter is available only after HTTP/HTTPS is enabled on ports. |
Response Timeout |
Timeout for waiting for a response from a backend server. After a request is forwarded to the backend server, if the backend server does not respond during the timeout duration, the load balancer will stop waiting and return HTTP 504 Gateway Timeout. |
This parameter is available only after HTTP/HTTPS is enabled on ports. |
apiVersion: v1 kind: Service metadata: annotations: kubernetes.io/elb.id: <your_elb_id> # In this example, an existing dedicated load balancer is used. Replace its ID with the ID of your dedicated load balancer. kubernetes.io/elb.class: performance # Load balancer type kubernetes.io/elb.keepalive_timeout: '300' # Timeout setting for client connections kubernetes.io/elb.client_timeout: '60' # Timeout for waiting for a request from a client kubernetes.io/elb.member_timeout: '60' # Timeout for waiting for a response from a backend server name: nginx spec: ports: - name: service0 port: 80 protocol: TCP targetPort: 80 selector: app: nginx type: LoadBalancer
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
kubernetes.io/elb.keepalive_timeout |
No |
String |
Timeout for client connections. If there are no requests reaching the load balancer during the timeout duration, the load balancer will disconnect the connection from the client and establish a new connection when there is a new request. Value:
|
kubernetes.io/elb.client_timeout |
No |
String |
Timeout for waiting for a request from a client. There are two cases:
The value ranges from 1 to 300 (in seconds). The default value is 60. |
kubernetes.io/elb.member_timeout |
No |
String |
Timeout for waiting for a response from a backend server. After a request is forwarded to the backend server, if the backend server does not respond within the duration specified by member_timeout, the load balancer will stop waiting and return HTTP 504 Gateway Timeout. The value ranges from 1 to 300 (in seconds). The default value is 60. |