loadbalancing for kubernetes in non-cloud environment

3/14/2019

I see that kubernetes can use ClusterIP and NodePort and LoadBalancing. For loadbalancing it requires cloud. If I do not have cloud provider how can I loadbalance traffic between nodes?! I know that HAProxy can loadbalance but I think this cloud loadbalancer is different from simple HAProxy

and I want to know what is different between HAProxy and IngressController such as HAProxy and Nginx

I want a loadbalancer to loadbalance traffic between my worker nodes. A service loadbalance traffic between pods.I think ingress controller is layer 7 loadbalancer. I want loadbalancing between my nodes

-- yasin lachini
cloud
haproxy
kubernetes
load-balancing

3 Answers

3/20/2019

You want to use nginx ingress controller or a service mesh like istio or linkerd for internal load balancing in kubernetes. What happens in the case of nginx is, that you create a service on top of pods. This service is an abstraction that can be load balanced, but still needs a loadbalancer to do so. the nginx can be used to do exactly this too internally. As you can imagine that is not perfect or awesome, which means it's not a bad idea to check out. have a look at envoy ( https://blog.turbinelabs.io/a-basic-service-mesh-with-envoy-71d16bb7347d ), istio ( https://istio.io/ ) and linkerd ( https://linkerd.io/ ) While it is totally possible to roll your own, those are solutions to address many of the missing functionality, so it can also already in the beginning make your life a lot easier. There is also MetalLB ( https://github.com/google/metallb ) which might be interesting for you. Hope that helps a bit to move forward.

-- sandrom
Source: StackOverflow

3/14/2019

I am facing the same problem here. K8s is made for the cloud in mind, so on premises brings some trouble to setup. On the article below it gives a detailed explanation about this.

https://medium.com/@JockDaRock/metalloadbalancer-kubernetes-on-prem-baremetal-loadbalancing-101455c3ed48

In summary the solutions are to use a NodePort or external Name services. The approach that I will try here is to use metalLB (https://metallb.universe.tf/, https://github.com/google/metallb) .

-- Leandro Donizetti Soares
Source: StackOverflow

3/20/2019

There should be no need in kubernetes to balance a load between nodes, because for kubernetes a backend is a pod, not a node.

So, you should consider an Ingress Controller, not a load balancer, since Kubernetes core controllers come without some controllers, and IC is one of them, and the ClusterIP type service already does basic load balancing.

Nginx IC is great. So as Istio (different concepts though). Traefik could be an option too. Check different IC options, and get the Ingress Controller concept clear.

-- suren
Source: StackOverflow