3

Do Kubernetes has it's own Load Balancer?

I read about LoadBalancer Service while deployment to expose it outside cluster, but it uses my cloud provider Load Balancer.

Kubernetes doesn't have it's own Load Balancer like Nginx had?

I also read External and internal Load Balancer. Does they talking about Cloud service provider Load Balancer?

Dhanraj
  • 833
  • 2
  • 8
  • 34
  • 2
    This post provides a thorough explanation of the LoadBalancer service in Kubernetes: https://stackoverflow.com/questions/41509439/whats-the-difference-between-clusterip-nodeport-and-loadbalancer-service-types – lasleyd Jun 14 '19 at 13:49
  • @Dhanraj If you ask about ability to setup your own LB in k8s, then check MetalLB to understand solution complexity - https://metallb.universe.tf/ Generally, Kubernetes stands around cloud provided resources, but any part of k8s could be customized for specific tasks. Also kube-router, coredns and flannel/calico docs will be helpful for you to understand manual k8s networking configuration. – SKorolchuk Jun 16 '19 at 17:53

3 Answers3

1

Note that if you deploy a Kubernetes service with type LoadBalancer, it deploys a L4 internal load balancer. It doesnt offer all those capabilities that you get with external load balancer.

most of the external load balancers these days handles Layer 7 in terms of http headers and content based routing etc.

you can look at ingress controller for advanced load balancer features on par with external load balancer. But you need to front it with external load balancer for HA

P Ekambaram
  • 9,536
  • 3
  • 21
  • 46
  • you L4 internal Load balancer is Load Balancer provided by cloud service provider? – Dhanraj Jun 14 '19 at 14:14
  • https://kubernetes.io/docs/concepts/services-networking/ this link says **LoadBalancer: Exposes the service externally using a cloud provider’s load balancer** – Dhanraj Jun 14 '19 at 14:17
  • say, you have three replicas of the pod running in the cluster. the service fronting the pods would load balance the traffic among the three pods – P Ekambaram Jun 14 '19 at 14:23
0

According to ServiceTypes

LoadBalancer: Exposes the service externally using a cloud provider’s load balancer. NodePort and ClusterIP services, to which the external load balancer will route, are automatically created.

So If you want something similar to Nginx proxy routing, you should check Ingress resource. It could help you.

The main principle: You have one LoadBalancer or NodePort Service for Ingress Controller that provisioned by cloud provider and multiple route rules through Ingress resources.

Presentation about Networking and Nginx Ingress Controller

Networking in k8s

SKorolchuk
  • 186
  • 1
  • 2
  • 8
  • Wait.. your main principle is confusing me.. let me study Ingress controller – Dhanraj Jun 14 '19 at 14:20
  • @Dhanraj No problem. Ingress resources always helps with saving money on cloud resources and securing your cluster. Also you should check features of popular `ingress controllers` [Ingress comparison list](https://kubedex.com/ingress/) – SKorolchuk Jun 14 '19 at 15:49
  • @Dhanraj Also If you're afraid of cloud load balancers, you can use `ingress controller` with `NodePort` service type. This service type will save you from LB allocation, but you will have a new issue - external port mapping for 80/443 ports. – SKorolchuk Jun 14 '19 at 15:54
0

Ingress is a solution available since kubernetes 1.1 that allows inbound connections to the cluster.

It's an alternative to the external LoadBalancers(i.e your cloud service provider load balancer) and nodePort

Ingress allows you to easily expose services that need to be accessible from outside the cluster

With Ingress you can run your own ingress controller(basically a loadbalancer) within kubernetes cluster.

There are default ingress controllers available or you can write your own ingress controller.