Configuração do tempo limite para um ingress do ELB
ELB Ingress支持设置以下超时时间:
- 客户端连接空闲超时时间:没有收到客户端请求的情况下保持连接的最长时间。If no request is received during this period, the load balancer releases the connection and establishes a new one with the client when the next request arrives.
- 等待客户端请求超时时间:如果在规定的时间内客户端没有发送完请求头,或body体数据发送间隔超过一定时间,负载均衡会自动关闭连接。
- 等待后端服务器响应超时时间:向后端服务器发送请求后,如果在一定时间内没有收到响应,负载均衡将返回504错误码。
Restrições
- Este recurso entra em vigor apenas nas seguintes versões:
- v1.19: v1.19.16-r30 ou mais recente
- v1.21: v1.21.10-r10 ou mais recente
- v1.23: v1.23.8-r10 ou mais recente
- v1.25: v1.25.3-r10 ou mais recente
- 仅在使用独享型ELB时,Ingress支持设置超时时间。
- 更新Ingress时,如果删除超时时间配置,不会修改已有监听器的超时时间配置。
设置超时时间
Ingress配置示例如下:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test
namespace: default
annotations:
kubernetes.io/elb.port: '80'
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
kubernetes.io/elb.keepalive_timeout: 300 # 客户端连接空闲超时时间
kubernetes.io/elb.client_timeout: 60 # 等待客户端请求超时时间
kubernetes.io/elb.member_timeout: 60 # 等待后端服务器响应超时时间
spec:
rules:
- host: ''
http:
paths:
- path: /
backend:
service:
name: test
port:
number: 80
property:
ingress.beta.kubernetes.io/url-match-mode: STARTS_WITH
pathType: ImplementationSpecific
ingressClassName: cce
|
Parâmetro |
Obrigatório |
Tipo |
Descrição |
|---|---|---|---|
|
kubernetes.io/elb.keepalive_timeout |
Não |
Integer |
Tempo limite para conexões do cliente. Se não houver solicitações chegando ao balanceador de carga após o término do tempo limite, o balanceador de carga desconectará a conexão com o cliente e estabelecerá uma nova conexão quando houver uma nova solicitação. 取值范围为0-4000s,默认值为60s。 |
|
kubernetes.io/elb.client_timeout |
Não |
Integer |
等待客户端请求超时时间,包括两种情况:
取值范围为1-300s,默认值为60s。 |
|
kubernetes.io/elb.member_timeout |
Não |
Integer |
等待后端服务器响应超时时间。请求转发后端服务器后,等待超过member_timeout时长没有响应,负载均衡将终止等待,并返回 HTTP504错误码。 取值范围为1-300s,默认值为60s。 |