A question about the ingress controller

I am testing the ingress controller in k8s, so I installed the Nginx ingress controller on the cluster which automatically created a loadBalancer service. I then created a deployment of type "ingress" to further customize the controller, I also created a BackendConfig and wired it with the services. Now, when I list the available services, I get "nginx-ingress-controller" with a public IP address exposing port 80, but when I do "kubectl get ingress" I get the ingress resource I deployed to customize the controller, which is also exposing a public IP address. My question is, why does the ingress resource create its own public address? I can access the IP/path of the loadBalancer on port 80 just fine, but the address of the ingress resource is not accessible at port 80. The loadBalancer exposes an IP of the sort 104.199.***.**, while the ingress resource created an IP similar to 34.80.***.**

Sorry, not sure I follow.

Can you share how you installed the ingress controller? Like which guide?

Usually, you get a node balancer service for your Ingress and then that routes to the right services (not type load balancer). I think that is the most common setup.

Thanks for your reply.

I followed this guide to setup Ingress with Nginx controller:

https://cloud.google.com/community/tutorials/nginx-ingress-gke

My question is, why does creating an ingress resource yield a new public IP address.

After following the guide in the link above, I get an “nginx-ingress-controller” of type LoadBalancer with a public IP address and that’s to be expected, but when I create an ingress resource in YAML to customize ingress paths, I see a new public IP address (still not accessible on port 80) when I do “kubectl get ingress”.

This is the YAML for the ingress resource:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: express-app-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
  rules:
    - http:
        paths:
          - path: /api
            backend:
              serviceName: express-app-service
              servicePort: 80

IIUC, the IP is just the load balancer to route traffic to your nginx.

You need traffic to be routed to your Ingress, and the IP is the way to have it.

The service you expose behind the Ingress just needs to be type clusterIP, so it won’t create any other load balancer nor anything.

The setup is: all traffic is routed to this Ingress nginx and then it decided to which service serve the traffic to.

Does it make sense now?