GCP Internal Load Balancer with ngnix ingress controller as nodeport : Connection Refused

2.2k views Asked by At

Background: We hosted application in a GKE cluster, the application running on the GKE cluster has an ingress resource containing the rules to point to our application services. We are using ingress-nginx as the ingress controller for this cluster..

We have now created a GCP Internal Load Balancer(TCP) to point to the nodeport where the ingress-controller service is listening. (Note: nginx ingress controller service" is of type node port)

  1. When we try to access application with http://ILB-IP:80 (http-port), it throws connection refused exception but gets a desired response when we access directly with nodeport http://ILB-IP:31380 (nodeport)

  2. When we give ingress service as type load balancer, GCP creates an ILB in the background. In this case application is accessible over http port and all the request is being served.

Can anyone help us to figure out when we explicitly creates ILB and sends the request, why application is not accessible when we are hitting the ILB front end on http port while the same is accessible when ILB front end is ILB-IP:?

Thanks in advance!

3

There are 3 answers

1
Mayur On BEST ANSWER

Over discussion with google support came to know that service type as LoadBalancer creates an IP table entry on each nodes, which allow traffic to redirect from port 80 to the defined node port.

So, if our use-case requires to create ILB explicitly and our application to be accessible over Node Port, Then "we have to manually edit the IP tables on each kubernetes node in order to traffic to be redirect from the port 80 to the node port"

1
Md Zubayer On

The ingress controller needs to be configured as type:LoadBalancer as described in this help center article, which will create an external LB to route the traffic to the services that are exposed via an Ingress resource, which is the expected way to do it.

When exposing the ingress controller as type:NodePort then the service is accessible on each Node’s IP at a static port as explained in here.

0
user2983509 On

Checkout this : https://medium.com/google-cloud/internal-load-balancing-for-kubernetes-services-on-google-cloud-f8aef11fb1c4

GCP has started supporting internal LB creation for K8S services.