Load balancing on baremetal

Hi,

I’m trying to wrap my head on loadbalancing between different nodes on baremetal kubernetes (coreos nodes).

Let’s consider a “minimal” setup of 2 cores master nodes and 2 coreos worker nodes living on two physical hosts.

What would be the preferred way to load balance these two hosts to wan? I’m thinking about a pfsense loadbalancing but haven’t been able to find a working example so far, anyone had any luck of making this work? (metalb, ingress, pfsense) or some other way?

There are a bunch of ways this can be done. You can quickly get this moving with an nginx instance where a location points to multiple back-ends.

This page describes in detail the numerous load balancing schemes nginx supports: http://nginx.org/en/docs/http/load_balancing.html

  • Round Robin
  • Least connected
  • Session Persistence
  • Weighted
  • Health Checks

Another really good option is HAProxy: http://www.haproxy.org/

Thanks for the answer,

As usual I wasn’t as clear of my goal as I should’ve been, so what I’m trying to accomplish is a load balanced high availibility setup with baremetal.

See here an example of the setup in cloud:

Since pfsense can be created as a HA setup and it provides haproxy load balancing I’m thinking that could be the easiest starting point for tests. Although I’m pretty sure that haproxy can’t provide the same kind of HA as the setup in the video above.

And if i were to use a nginx/ ingress loadbalancer how do I HA those then? Maybe this is where the MetalLB or Traefik comes in.

Any tutorials/ help/ success or failure stories would be appreciated.

@mikko777

In order to make kubernetes api server HA, external load balancer pointing to the multiple apiservers is the only way. Or dns round robin, but it’s not real HA.
Kubernetes controller manager uses raft for HA, so you’d want at least 3 nodes.

If you use nginx/ingress, in order to make that HA, there are multiple options. As you mentioned, you can use MetalLB for a floating ip address. Another option is to simply route the cluster IP range to your network. You can also use NodePort to listen the host ip address and then create a external load balancer.

Excellent, thank you.

Also found that the official documentation had updated info:
https://kubernetes.io/docs/setup/independent/high-availability/

Hopefully I’ll have time to test this in real life during the summer.