简体   繁体   English

nginx 入口控制器记录 499

[英]nginx Ingress controller logs 499

I have an azure Kubernetes cluster, deployed as shown below.我有一个 azure Kubernetes 集群,部署如下所示。 I have a long-running api which takes about 2 minutes to complete.我有一个长时间运行的 api,需要大约 2 分钟才能完成。 Sometimes when the request is being processed on the kubernetes POD, nginx ingress controller logs an error with status code 499. As per nginx log, 499 is client closed connection.有时在 kubernetes POD 上处理请求时,nginx 入口控制器会记录一个错误,状态码为 499。根据 nginx 日志,499 是客户端关闭的连接。 I have set the nginx time out to 10 minutes (for test).我已将 nginx 超时设置为 10 分钟(用于测试)。 I want to understand who is the client for nginx here.我想了解这里 nginx 的客户端是谁。 Is it the application load balancer or the application POD?是应用负载均衡器还是应用POD? Please note that the underlying .NET core Api continues with the request processing请注意底层 .NET core Api 继续处理请求

Log:日志:

[10.XX.XX.5] "POST /test HTTP/1.1" 499 0 " https://test.test/ " 2345 120.601 [default-test-service-80] 10.xx.xx.xx:80 0 120.603 [10.XX.XX.5] "POST /test HTTP/1.1" 499 0 " https: //test.test/ " 2345 120.601 [default-test-service-80] 10.xx.xx.xx:80 0 120.603

在此处输入图片说明

To learn about what does the log mean, you need to know how does it define the logs format for the Nginx.要了解日志的含义,您需要知道它是如何定义 Nginx 的日志格式的。 So you can go inside the pod of the Nginx ingress and look at the config for the Nginx, and it shows like this:所以你可以进入 Nginx 入口的 pod 并查看 Nginx 的配置,它显示如下:

log_format upstreaminfo '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr $upstream_response_length $upstream_response_time $upstream_status $req_id';

And you can find the document about how does the Nginx defines the variables in the logs format.您可以找到有关 Nginx 如何以日志格式定义变量的文档。 The document describes here:文件在此处描述:

$remote_addr - x.x.x.x - The IP address of the client making the request.

And in your exact log, the remote address is "10.XX.XX.5".在您的确切日志中,远程地址是“10.XX.XX.5”。 It's the IP address of the AKS node which hosts the Nginx ingress pod.它是托管 Nginx 入口 pod 的 AKS 节点的 IP 地址。

A. The client for the Nginx here is the AKS node that hosts the Ningx Ingress pod. A.这里 Nginx 的客户端是托管 Ningx Ingress pod 的 AKS 节点。

Finally, as I think, the requests routing path is AGW -> ALB -> AKS_node -> Nginx_ingress_controller -> service -> application_pod.最后,我认为,请求的路由路径是 AGW -> ALB -> AKS_node -> Nginx_ingress_controller -> service -> application_pod。

Check your application gateway timeout检查您的应用程序网关超时

HTTP Settings > your setting name > Request time-out (seconds) HTTP 设置 > 您的设置名称 > 请求超时(秒)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM