Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Kubernetes Istio侵入导致;没有健康的上游”;_Kubernetes_Istio - Fatal编程技术网

Kubernetes Istio侵入导致;没有健康的上游”;

Kubernetes Istio侵入导致;没有健康的上游”;,kubernetes,istio,Kubernetes,Istio,我正在使用部署一个外向的服务,该服务在一个节点端口和一个istio入口后面公开。展开使用手动侧车喷射。一旦部署、节点端口和入口运行,我就可以向istio入口发出请求 出于某种未知的原因,请求没有路由到我的部署,而是显示文本“no Health upstream”。这是为什么?是什么原因造成的 我可以在http响应中看到状态代码是503(服务不可用),服务器是“特使”。部署正在运行,因为我可以将端口映射到它,并且一切都按预期工作。虽然这是由于Istio设置不正确导致的路由问题而导致的一般性错误,但

我正在使用部署一个外向的服务,该服务在一个节点端口和一个istio入口后面公开。展开使用手动侧车喷射。一旦部署、节点端口和入口运行,我就可以向istio入口发出请求

出于某种未知的原因,请求没有路由到我的部署,而是显示文本“no Health upstream”。这是为什么?是什么原因造成的


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

虽然这是由于Istio设置不正确导致的路由问题而导致的一般性错误,但我将向遇到相同问题的任何人提供一般性解决方案/建议


在我的案例中,问题是由于路由规则配置不正确,Kubernetes本机服务正在运行,但是Istio路由规则配置不正确,因此Istio无法从入口路由到服务。

当我的pod处于
容器创建
状态时,我遇到了这个问题。因此,它导致了503错误。也如@pegaldon所述,这也可能是由于路由配置不正确或用户没有创建网关造成的。

删除destinationrules.networking.istio.io 并重新创建virtualservice.networking.istio.io

[root@10-20-10-110 ~]#旋度http://dprovider.example.com:31400/dw/provider/beat
没有健康的上游[root@10-20-10-110 ~]# 
[root@10-20-10-110 ~]#旋度http://10.210.11.221:10100/dw/provider/beat
"该服务节点  10.210.11.221  心跳正常!"[root@10-20-10-110 ~]# 
[root@10-20-10-110 ~]# 
[root@10-20-10-110 ~]#cat/home/example_service_yaml/vs/dw-provider-service.yaml
apiVersion:networking.istio.io/v13
种类:虚拟服务
元数据:
名称:dw提供商服务
名称空间:示例
规格:
主持人:
-“dprovider.example.com”
网关:
-示例网关
http:
-路线:
-目的地:
主机:dw提供程序服务
端口:
电话:10100
子集:“v1-0-0”
---
apiVersion:networking.istio.io/v13
种类:命运法则
元数据:
名称:dw提供商服务
名称空间:示例
规格:
主机:dw提供程序服务
子集:
-名称:“v1-0-0”
标签:
版本:1.0.0
[root@10-20-10-110~]#vi/home/example_service_yaml/vs/dw-provider-service.yaml
[root@10-20-10-110 ~]#kubectl-n示例get vs-o wide | grep dw
dw收集服务[示例网关][dw.collection.example.com]72d
dw平台服务[示例网关][dplatform.example.com]81d
dw提供商服务[示例网关][dprovider.example.com]21m
数据同步服务[示例网关][数据同步服务dsync.example.com]34d
[root@10-20-10-110 ~]#kubectl-n示例删除vs dw提供程序服务
virtualservice.networking.istio.io“dw提供程序服务”已删除
[root@10-20-10-110 ~]#kubectl-n示例删除数据仓库提供程序服务
守护程序集.apps deniers.config.istio.io部署.extensions dogstatsds.config.istio.io
守护程序集.extensions部署.apps目标规则.networking.istio.io
[root@10-20-10-110 ~]#kubectl-n示例删除destinationrules.networking.istio.io dw提供程序服务
destinationrule.networking.istio.io“dw提供程序服务”已删除
[root@10-20-10-110 ~]#kubectl apply-f/home/example_service_yaml/vs/dw-provider-service.yaml
已创建virtualservice.networking.istio.io/dw-provider-service
[root@10-20-10-110 ~]#旋度http://dprovider.example.com:31400/dw/provider/beat
"该服务节点  10.210.11.221  心跳正常!"[root@10-20-10-110 ~]# 

[root@10-20-10-110 ~]#
以防万一,就像我一样,你会感到好奇……尽管在我的场景中,很明显是错误

错误原因:我有两个版本的相同服务(v1和v2),一个Istio VirtualService配置了使用权重的流量路由目的地。然后,95%转到v1,5%转到v2。当然,由于我还没有部署v1,错误“503-没有正常的上游”显示了95%的请求

好的,尽管如此,我知道问题以及如何解决它(仅部署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.

在我看来,应用程序容器没有接受请求。你能检查一下你的pod中应用程序容器的日志吗?@SureshVishnoi最后要打印的日志是
[warning][main]external/embasic/source/server/drain\u manager\u impl.cc:62]在drain之后关闭parent
,在这之前两行有一个错误,说明
“GET/HTTP/1.1“404nr0-”-“谷歌api节点客户端/0.10.0“
父母在这里是什么意思?如果它是主应用程序容器,那么它将重新启动。您可以使用以下命令检查主容器的日志
kubectl logs POD\u NAME-c container\u NAME
。检查其是否重新启动或终止是否有解决此问题的方法?我在相关播客中找不到有关此问题的日志,我已尝试重新启动这些播客,但仍然无法工作。我面临类似问题。你介意分享更多关于你如何解决这个问题的细节吗?那会很有帮助的。