GCE上的Kubernetes:入口超时配置

问题描述:

我正在Google Compute Engine(GCE)上运行Kubernetes.我设置了一个Ingress.一切正常,除了我上传大文件时,L7 HTTPS负载平衡器会在30秒后终止连接.我知道我可以在后端服务"中手动进行此操作,但是我想知道是否有一种方法可以从Ingress规范中执行此操作.我担心我的手动调整将在以后更改回30秒.

I'm running Kubernetes on Google Compute Engine (GCE). I have an Ingress set up. Everything works perfectly except when I upload large files, the L7 HTTPS Load Balancer terminates the connection after 30 seconds. I know that I can bump this up manually in the "Backend Service", but I'm wondering if there is a way to do this from the Ingress spec. I worry that my manual tweak will get changed back to 30s later on.

nginx入口控制器具有许多可用于配置nginx的注释.GCE L7负载平衡器是否有类似的东西?

The nginx ingress controller has a number of annotations that can be used to configure nginx. Does the GCE L7 Load Balancer have something similar?

现在可以使用自定义资源 BackendConfig 在GKE内对其进行配置.

This can now be configured within GKE, by using a custom resource BackendConfig.

apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
  name: my-bconfig
spec:
  timeoutSec: 60

然后将您的 Service 配置为使用带有注释的此配置:

And then configuring your Service to use this configuration with an annotation:

apiVersion: v1
kind: Service
metadata:
  name: my-service
  annotations:
    beta.cloud.google.com/backend-config: '{"ports": {"80":"my-bconfig"}}'
spec:
  ports:
  - port: 80
  .... other fields

请参见通过Ingress配置后端服务