Does Kubernetes create an external load balancer for every LoadBalancer service, or does it just reuse the same one?

250 views Asked by At

When you create a Service of type LoadBalancer in Kubernetes, does it create a brand new external load balancer, or does it just create a single load balancer for the first Service of type LoadBalancer and re-use that same load balancer for all subsequent Services of type LoadBalancer?

This question is of particular importance, because spinning up a separate load balancer for every service would be cost prohibitive for me.

If it is specific to the cloud provider, I am using Azure, but I would be curious to know if other cloud providers differ.

2

There are 2 answers

0
tuxiedev On BEST ANSWER

On Azure I have observed that Kubernetes does not create a load balancer per service entry. In fact it creates a Load Balancing Rule in the kubernetes load balancer present inside the cluster managed resource-group (the MC_* one)

In AWS and GCP a new load balancer is created for every instance of a service.

0
Hanlin Shi On

This is case by case for each cloud provider. My experience with on-prem VMware solution is that they're creating a dedicated LB instance for each LB type service. Speaking of reusing LB resources, from my experiencing you could use layer-7 LB(i.e. ingress) instead of layer-4 LB. L4 loadbalancing is typically coupled with providers' underlying infrastructure where L7 loadbalancing, depending on the solution you're using, you could choose in-cluster LB(e.g. contour) instead of the ones providers feed you.