当请求花了60多秒做出响应时,入口控制器似乎会跳回
据我所见,NGNNX入口控制器在处理请求超过60秒后将504返回给客户端。我可以从NGINX日志中看到这一点:
2019/01/25 09:54:15 [error] 2878#2878: *4031130 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.244.0.1, server: myapplication.com, request: "POST /api/text HTTP/1.1", upstream: "http://10.244.0.39:45606/api/text", host: "myapplication.com"
10.244.0.1 - [10.244.0.1] - - [25/Jan/2019:09:54:15 +0000] "POST /api/text HTTP/1.1" 504 167 "-" "PostmanRuntime/7.1.6" 2940 60.002 [default-myapplication-service-80] 10.244.0.39:45606 0 60.000 504 bdc1e0571e34bf1223e6ed4f7c60e19d
第二个日志项显示上游响应时间和请求时间(请参见NGINX log format here)
为60秒但是我在入口配置中将所有超时值指定为3分钟:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: aks-ingress
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/send_timeout: "3m"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "3m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3m"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3m"
spec:
tls:
- hosts:
- myapplication.com
secretName: tls-secret
rules:
- host: myapplication.com
http:
paths:
- path: /
backend:
serviceName: myapplication-service
servicePort: 80
我想念什么?
我正在Azure(AKS)上使用nginx-ingress-1.1.0和k8s 1.9.11。
答案 0 :(得分:1)
由于您似乎正在使用ngnix.com的实际入口,因此您需要使用nginx.org/proxy-connect-timeout: "3m"
样式注释,就像在
their example
我仍然非常确定,kubectl cp
-将nginx.conf
移出控制器Pod的调试技巧可以帮助您自行调试这种情况,但是请务必阅读有关入口的文档控制器也会走很长一段路
尽管这对您可能并不重要,但他们的latest release也是1.4.3,因此我希望您是故意使用旧版本。
答案 1 :(得分:1)
已通过为这些注释提供整数值(以秒为单位)解决了该问题:
nginx.ingress.kubernetes.io/proxy-connect-timeout: "180"
nginx.ingress.kubernetes.io/proxy-read-timeout: "180"
nginx.ingress.kubernetes.io/proxy-send-timeout: "180"
NGINX入口控制器的this variation似乎需要这样做。