Nginx Ingress for Kubernetes "Connection refused"

6/16/2018

Was there a recent change to Nginx Ingress? Out of the blue I'm now getting "Connection refused" errors. I thought it was my own configuration which worked on a previous cluster.

Instead I decided to follow this tutorial GKE NGINX INGRESS and I'm getting the same result.

$ kubectl get deployments --all-namespaces
NAMESPACE     NAME                            DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
default       hello-app                       1         1         1            1           13m
default       nginx-ingress-controller        1         1         1            1           12m
default       nginx-ingress-default-backend   1         1         1            0           12m

I see the default-backend isn't running but I don't know enough about Kubernetes to know if that's what's preventing everything from working properly.

$ kubectl get svc
NAME                            TYPE           CLUSTER-IP      EXTERNAL-IP    PORT(S)                      AGE
hello-app                       ClusterIP      10.31.255.90    <none>         8080/TCP                     14m
kubernetes                      ClusterIP      10.31.240.1     <none>         443/TCP                      19m
nginx-ingress-controller        LoadBalancer   10.31.251.198   35.227.50.24   80:31285/TCP,443:30966/TCP   14m
nginx-ingress-default-backend   ClusterIP      10.31.242.167   <none>         80/TCP                       14m

Finally:

$ kubectl get ing
NAME               HOSTS     ADDRESS         PORTS     AGE
ingress-resource   *         35.237.184.85   80        10m

According to the tutorial I should just be able to go to here to receive a 200 and here to get a 404.

I've left the links live so you all can see them.

$ curl -I http://35.237.184.85/hello
curl: (7) Failed to connect to 35.237.184.85 port 80: Connection refused

I swear everything worked before and the only thing I can think of is that something from the teller install of nginx-ingress changed.

Please, any help is appreciated! Thank you in advance!

-- jmvbxx
google-kubernetes-engine
kubernetes
nginx

1 Answer

6/16/2018

That's because you are trying the request against the IP address created by the Ingress. Your entrypoint is the LoadBalancer type service created IP.

Try curl -I http://35.227.50.24/hello. That's where you will get 200.

-- suren
Source: StackOverflow