如何正确更改节点代理的 TCP 保持事件时间?
我在 Google Container Engine 中运行 Kubernetes,并设置了一个由 HTTP(S) Google Load Balancer 支持的入口。当我不断向入口发出 POST 请求时,我每 80 秒左右就会收到一次 502 错误。 backend_connection_closed_before_data_sent_to_client
Cloud Logging 中的错误,这是因为 GLB 的 tcp keepalive(600 秒)大于节点代理的 keepalive(不知道它是什么)。
记录的错误在 https://cloud.google.com/compute/docs/load-balancing/http/ 中有详细说明.
谢谢!
最佳答案
您可以使用自定义资源 BackendConfig
存在于每个 GKE 集群上以配置超时和其他参数,如 CDN here是文档
来自 here 的示例显示如何在入口配置
那就是 BackendConfig
定义:
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
name: my-bsc-backendconfig
spec:
timeoutSec: 40
connectionDraining:
drainingTimeoutSec: 60
这就是如何通过注释在入口定义上使用
apiVersion: v1
kind: Service
metadata:
name: my-bsc-service
labels:
purpose: bsc-config-demo
annotations:
beta.cloud.google.com/backend-config: '{"ports": {"80":"my-bsc-backendconfig"}}'
spec:
type: NodePort
selector:
purpose: bsc-config-demo
ports:
- port: 80
protocol: TCP
targetPort: 8080
关于proxy - 更改 Kubernetes 的节点代理 tcp 保持事件时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44733221/