gpt4 book ai didi

kubernetes - Istio Ingress 导致 "no healthy upstream"

转载 作者:行者123 更新时间:2023-12-03 01:13:44 47 4
gpt4 key购买 nike

我正在部署一个面向外部的服务,该服务暴露在节点端口后面,然后暴露在 istio 入口后面。该部署使用手动 sidecar 注入(inject)。一旦部署、nodeport 和 ingress 运行,我就可以向 istio ingress 发出请求。

出于某种未知的原因,请求不会路由到我的部署,而是显示文本“没有健康的上游”。这是为什么,又是什么原因造成的?

我可以在http响应中看到状态代码是503(服务不可用)并且服务器是“envoy”。部署正在运行,因为我可以将端口转发到它,并且一切都按预期工作。

最佳答案

以防万一,像我一样,你会感到好奇......即使在我的场景中,错误的情况很明显......

错误原因: 我有同一服务的两个版本(v1 和 v2),以及使用权重配置了流量路由目标的 Istio VirtualService。然后,95% 进入 v1,5% 进入 v2。当然,由于我还没有部署 v1,所以 95% 的请求都会出现错误“503 - nohealthyupstream”。

好吧,即便如此,我知道问题所在以及如何修复它(只需部署 v1),我想知道...但是,我如何才能获得有关此错误的更多信息?我怎样才能更深入地分析这个错误以找出发生了什么?

这是一种使用 Istio 配置命令行实用程序 istioctl 进行研究的方法:

# 1) Check the proxies status -->
$ istioctl proxy-status
# Result -->
NAME CDS LDS EDS RDS PILOT VERSION
...
teachstore-course-v1-74f965bd84-8lmnf.development SYNCED SYNCED SYNCED SYNCED istiod-86798869b8-bqw7c 1.5.0
...
...

# 2) Get the name outbound from JSON result using the proxy (service with the problem) -->
$ istioctl proxy-config cluster teachstore-course-v1-74f965bd84-8lmnf.development --fqdn teachstore-student.development.svc.cluster.local -o json
# 2) If you have jq install locally (only what we need, already extracted) -->
$ istioctl proxy-config cluster teachstore-course-v1-74f965bd84-8lmnf.development --fqdn teachstore-course.development.svc.cluster.local -o json | jq -r .[].name
# Result -->
outbound|80||teachstore-course.development.svc.cluster.local
inbound|80|9180-tcp|teachstore-course.development.svc.cluster.local
outbound|80|v1|teachstore-course.development.svc.cluster.local
outbound|80|v2|teachstore-course.development.svc.cluster.local

# 3) Check the endpoints of "outbound|80|v2|teachstore-course..." using v1 proxy -->
$ istioctl proxy-config endpoints teachstore-course-v1-74f965bd84-8lmnf.development --cluster "outbound|80|v2|teachstore-course.development.svc.cluster.local"
# Result (the v2, 5% of the traffic route is ok, there are healthy targets) -->
ENDPOINT STATUS OUTLIER CHECK CLUSTER
172.17.0.28:9180 HEALTHY OK outbound|80|v2|teachstore-course.development.svc.cluster.local
172.17.0.29:9180 HEALTHY OK outbound|80|v2|teachstore-course.development.svc.cluster.local

# 4) However, for the v1 version "outbound|80|v1|teachstore-course..." -->
$ istioctl proxy-config endpoints teachstore-course-v1-74f965bd84-8lmnf.development --cluster "outbound|80|v1|teachstore-course.development.svc.cluster.local"
ENDPOINT STATUS OUTLIER CHECK CLUSTER
# Nothing! Emtpy, no Pods, that's explain the "no healthy upstream" 95% of time.

关于kubernetes - Istio Ingress 导致 "no healthy upstream",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47664397/

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