Search code examples
azuredockernginxkuberneteskubectl

Azure Kubernetes - not able to connect pod containers


I am running a Kubernetes 1.8 on Azure AKS. I have docker images deployed to a pod. I have created a Azure public ip(static) which I give to the NGinx ingress-controller when I create it. Kubectl get ingress shows that the ip has been assigned to it and /healthz endpoint returns 200 OK.

kubectl describe ingress shows:

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

When I request the host I get a 502 bad gateway. If I use ip, I get 404 not found. Same ip, which returns 200 ok from /healthz.

Containers and setup in general has been tested in Minikube and is working.

What could be the problem that my containers are not exposed through the ingress? Describes looks the same when compared to the Minikube's.


Solution

  • What's happening is that the wiring between the ingress and the service your pods back is not correct. The logs from the ingress pod will probably help. 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.

    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.