How to fix: Empty IP Address for nginx-ingress on digital-ocean

5/26/2019

In my k8s cluster the ingress does not work on the k8s cluster of digital ocean. I don't get an external ip and so it is not available. Locally there seems to be no problem.

I already searched a lot and tried some tutorials, f.e. https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes. But it seems that it is an older version and the solution (and even the links) does not work anymore.

The nginx-ingress should call the service of a website backend which is on port 8080.

I stripped down my ingress code to the following one:

kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: website
          servicePort: 8080

With kubectl get ing I see the ingress, but it has no address. It looks like this

NAME           HOSTS   ADDRESS   PORTS   AGE
test-ingress   *                 80      50s

Can anyone help me out and tell me what I have to do to get my k8s cluster running?

Thanks peter

-- Peter Lang
digital-ocean
kubernetes

1 Answer

5/27/2019

Firstly, if you are using Nginx Ingress Controller, you don't need to see ingress address.

When you install Nginx Ingress Controller to your k8s cluster, it creates Load Balancer to handle all incoming requests. Make sure that below part completed as explained in Step 2 of guide you posted and you are able to see LoadBalancer External ip address.

$ kubectl get svc --namespace=ingress-nginx

You should see an external IP address, corresponding to the IP address of the DigitalOcean Load Balancer:

Output
NAME            TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)                      AGE
ingress-nginx   LoadBalancer   10.245.247.67   203.0.113.0   80:32486/TCP,443:32096/TCP   20h

In above case, after deploying your ingress resource, if you hit http://203.0.113.0 you will get your website:8080 backend service.

Hope it helps!

-- coolinuxoid
Source: StackOverflow