May I use a normal load balancer to expose a Kubernetes Service?

7/26/2019

Is it advisable to use a normal Google Cloud Load Balancer pointing to my Kubernetes services?

I'm new to Kubernetes and I feel way more familiarized with the way normal Google Cloud Balancers are configured.

-- Guillermo
google-kubernetes-engine
kubernetes

3 Answers

7/27/2019

The different load balancers are more about what you are wanting to do.

If you are wanting to do multi-region that is where the GCLB comes into play enter link description here

If you are not planning or needing multi-region then no reason to implement it. For more information, I would probably start here

https://cloud.google.com/kubernetes-engine/docs/how-to/exposing-apps https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing https://cloud.google.com/kubernetes-engine/docs/how-to/container-native-load-balancing

-- Ron
Source: StackOverflow

7/26/2019

There's nothing wrong with it AFAIK, though people with more Kubernetes experience than GCP/Terraform/... might find it a little unusual.

See the discussion of LoadBalancer type services in the Kubernetes documentation for some background. In particular, this notes for LoadBalancer services

NodePort and ClusterIP Services, to which the external load balancer routes, are automatically created.

You can do the same thing by hand if you'd like: create a NodePort type service, then create an external load balancer that routes to that exposed port on any or all nodes. Keeping track of the list of nodes is a potential issue, and you either need to statically assign nodePort: values or find them after services are created.

Depending on how your organization is structured, even if a development team can deploy their own code into the cluster, you'll probably require your operations team to set up the external load balancer, which could be either good ("governance") or bad ("inflexible").

-- David Maze
Source: StackOverflow

7/26/2019

If you use a LoadBalancer type service[1], you will be provided with a network load balancer, which you configure using the kubernetes yaml.

According to this[2] tutorial, however, if you are exposing an HTTP(S) service, you are better off using a NodePort type service, and creating an Ingress object, which creates an HTTP(S) load balancer for you.

These are more idiomatic, so unless they doesn't give you what you need, I'd try one of these first.

[1] https://cloud.google.com/kubernetes-engine/docs/concepts/service#services_of_type_loadbalancer

[2] https://cloud.google.com/kubernetes-engine/docs/tutorials/http-balancer

-- Robert
Source: StackOverflow