gpt4 book ai didi

kubernetes - Ingressgateway返回的状态代码与Pod不同

转载 作者:行者123 更新时间:2023-12-02 12:17:54 26 4
gpt4 key购买 nike

我在GKE上安装Istio并运行该应用程序。

尽管使用curl访问时没有问题,但是从浏览器访问时,Ingressgateway通过某些图像请求返回的状态代码与Pod代理的状态代码不同。具体来说,将200和302等返回为500或504。每次变为500或504的资源都不同,但是在大约100个图像请求中,资源是1或2。并且,如果您再次请求另一个500或504请求,则正确的响应将毫无问题地返回。

您知道造成这种原因的原因吗?

环境就是这样。
GKE 1.10.11-gke.1
Istio 1.0.4

helm install install/kubernetes/helm/istio --name istio --namespace istio-system --set tracing.enabled=true --set kiali.enabled=true  --set global.proxy.includeIPRanges="10.0.0.0/8"

下面是从Stackdriver Logging获得的日志。

Ingressgateway日志。
"[2019-01-22T09:16:17.048Z] \"GET /my/app/image.pngHTTP/2\" 504 UT 0 24 60001 - \"xxx.xxx.xxx.xxx\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\" \"c0abe3be-1153-45c5-bd8e-067ab597feb4\" \"my.app.com\" \"10.128.0.116:80\" outbound|80|ga|myapp.default.svc.cluster.local - 10.128.0.16:443 xxx.xxx.xxx.xxx:62257\n"

应用程序Pod的组织代理日志。
"[2019-01-22T09:16:17.048Z] \"GET /my/spp/images.pngHTTP/1.1\" 200 - 0 3113 0 0 \"xxx.xxx.xxx.xxx\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\" \"c0abe3be-1153-45c5-bd8e-067ab597feb4\" \"my.app.com\" \"127.0.0.1:80\" inbound|80||myapp.default.svc.cluster.local - 10.128.0.116:80 xxx.xxx.xxx.xxx:0\n"

nginx日志。
{
"uri": "/my/app/image.png",
"host": "my.app.com",
"requestTime": "0.000",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"xForwardedProto": "https",
"user": "",
"protocol": "HTTP/1.1",
"bodyByteSize": "3113",
"method": "GET",
"remoteAddress": "127.0.0.1",
"upstreamResponseTime": "",
"request": "GET /my/app/images.png HTTP/1.1",
"referrer": "https://my.app.com/",
"status": "200",
"xForwardedFor": "xxx.xxx.xxx.xxx"
}

查看此日志,我认为Ingressgateway正在删除Pod的响应。

最佳答案

proxy's log中的UT表示发生了超时:

UT: Upstream request timeout in addition to 504 response code.



通过在 Connection Pool Settings中指定 Destination Rule来尝试增加连接超时:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: myapp
namespace: default
spec:
host: myapp.default.svc.cluster.local
trafficPolicy:
connectionPool:
tcp:
connectTimeout: 10s

关于kubernetes - Ingressgateway返回的状态代码与Pod不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54323340/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com