gcloud container engine - Network Load Balancing cost

9/15/2017

I have a kubernetes setup running in google container engine. one of the k8s Service "type: LoadBalancer"... so i guess it created a Google Network Load Balancing. Now part of my billing "Compute Engine Network Load Balancing" is way higher than my compute engine cost. Is there a way to eliminate "Network Load Balancing" cost item with any other solution in kubernates...please advise.

This question is close to what I'm looking for:

GCP Kube-Lego forwarding rule pricing

...but no answers so far.

-- sriba
google-kubernetes-engine
kubernetes
load-balancing

1 Answer

9/23/2017

1) Deploy nginx-ingress-controller to kube-cluster:

helm install --name my-lb stable/nginx-ingress --set controller.service.type=NodePort
helm list
kubectl get svc 

This will create "my-lb-nginx-ingress-controller" - a custom nginx load balancer instead of gke-load-balancer(google's). This will implement ingress rule objects in the kube-cluster. *** After this, any ingress rule object created with "annotations: kubernetes.io/ingress.class: nginx", will be enforced by this ngnix-controller.

2) Create firewall rule to open nodePorts: Since nginx-controller deployed as "conroller.service.type=NodePort", check the nodePorts from "kubect get svc" command and create gcloud "networking/firewall" rule to allow ports "tcp:31181;tcp:31462". Now you can use browser to reach "http://node-ip-address:31181" or "https://node-ip-address:31462" reach ngnix controllers..

3) Delete stuff:

helm delete my-lb
helm del --purge my-lb

I did above in gke, and now i have ngnix-load-balancer instead of google's cloud-load-balancer. But one limitation i experience is "http://node-ip:80" gets connection refused...don't know why is this. But, access through nodeport "http://node-ip-address:31181" is working. Ok for now, have to figure out port 80 access denial.

-- sriba
Source: StackOverflow