【问题标题】:How to configure nginx ingress resource timeout parameters如何配置nginx入口资源超时参数
【发布时间】:2017-11-01 13:25:34
【问题描述】:

所以这是我的问题,我想在 Kubernetes 入口资源 3 中设置超时参数。 Kubernetes 文档中描述的方法是使用入口资源注释或 ConfigMap。在下面的示例中,我尝试使用注释,但由于未知原因,更改没有生效。

nginx.org/proxy-connect-timeout: 10s
nginx.org/proxy-read-timeout: 10s
nginx.org/proxy-send-timeout: 10s

我正在我的入口资源定义中设置这些参数:

kind: Ingress
metadata:
  name: my-foobar-ingress
  namespace: foobar
  annotations:
    nginx.org/proxy-send-timeout: "10s"
    nginx.org/proxy-connect-timeout: "10s"
    nginx.org/proxy-read-timeout: "10s"

spec:
  rules:
  - host: foobar.foo.bar
    http:
      paths:
      - backend:
          serviceName: foobar-svc
          servicePort: 8080
        path: /

另一种设置 nginx 配置的方法是通过 ConfigMap,但我不想在全局范围内这样做,所以我需要使用注解来这样做。

【问题讨论】:

    标签: nginx kubernetes


    【解决方案1】:

    您确定这些是正确的注释吗?查看ingress/annotations/proxy/main.go,其中定义了以下常量:

    connect      = "ingress.kubernetes.io/proxy-connect-timeout"
    send         = "ingress.kubernetes.io/proxy-send-timeout"
    read         = "ingress.kubernetes.io/proxy-read-timeout"
    

    【讨论】:

    • 今天我用 ingress.kubernetes.io 尝试过,但我不得不去掉“s”并将其设置为“ingress.kubernetes.io/proxy-send-timeout: 10”
    • 非常感谢!
    • 一些文档:github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/… 超时以秒为单位,是一个数字,例如,不是 60 秒。必须是 ingress.kubernetes.io/proxy-read-timeout : 60
    猜你喜欢
    • 2021-12-16
    • 2019-07-22
    • 1970-01-01
    • 2019-12-16
    • 2019-09-30
    • 1970-01-01
    • 2021-05-16
    • 2013-10-22
    • 2017-11-19
    相关资源
    最近更新 更多