简体   繁体   English

Azure Kubernetes-无法连接Pod容器

[英]Azure Kubernetes - not able to connect pod containers

I am running a Kubernetes 1.8 on Azure AKS. 我正在Azure AKS上运行Kubernetes 1.8。 I have docker images deployed to a pod. 我将Docker映像部署到了Pod。 I have created a Azure public ip(static) which I give to the NGinx ingress-controller when I create it. 我创建了一个Azure公共ip(静态),在创建它时将其提供给NGinx入口控制器。 Kubectl get ingress shows that the ip has been assigned to it and /healthz endpoint returns 200 OK. Kubectl get ingress显示该IP已分配给它,并且/ healthz端点返回200 OK。

kubectl describe ingress shows: kubectl描述入口显示:

   Rules:   
Host                             Path    Backends   
service1.default.example.com     /       service1:80 (<none>)

When I request the host I get a 502 bad gateway. 当我请求主机时,我得到了502错误的网关。 If I use ip, I get 404 not found. 如果使用ip,则找不到404。 Same ip, which returns 200 ok from /healthz. 相同的IP,从/ healthz返回200 OK。

Containers and setup in general has been tested in Minikube and is working. 容器和设置总体上已经在Minikube中进行了测试,并且可以正常工作。

What could be the problem that my containers are not exposed through the ingress? 我的容器没有通过入口暴露出来可能是什么问题? Describes looks the same when compared to the Minikube's. 与Minikube相比,描述的外观相同。

What's happening is that the wiring between the ingress and the service your pods back is not correct. 发生的情况是入口与Pod返回的服务之间的接线不正确。 The logs from the ingress pod will probably help. 入口Pod的日志可能会有所帮助。 There could be a few specific things wrong. 可能有一些特定的错误。

The reason that requesting the IP directly gives a response is that the IP does not match an ingress -> service rule, so you are just getting the default back end for the ingress- which gives you the 404. 请求IP直接给出响应的原因是IP与入口->服务规则不匹配,因此您只是获得了入口的默认后端-为您提供了404。

So the ingress is fine. 所以入口很好。 And the service and pods themselves are probably fine. 服务和豆荚本身可能还不错。 But something is wrong with the wiring between the ingress and the service. 但是入口与服务之间的连线出了点问题。

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

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