17 MetalLB #
See MetalLB official documentation.
MetalLB is a load-balancer implementation for bare-metal Kubernetes clusters, using standard routing protocols.
In bare-metal environments, setting up network load balancers is notably more complex than in cloud environments. Unlike the straightforward API calls in cloud setups, bare-metal requires either dedicated network appliances or a combination of load balancers and Virtual IP (VIP) configurations to manage High Availability (HA) or address the potential Single Point of Failure (SPOF) inherent in a single node load balancer. These configurations are not easily automated, posing challenges in Kubernetes deployments where components dynamically scale up and down.
MetalLB addresses these challenges by harnessing the Kubernetes model to create LoadBalancer type services as if they were operating in a cloud environment, even on bare-metal setups.
There are two different approaches, via L2 mode (using ARP tricks) or via BGP. Mainly L2 does not need any special network gear but BGP is in general better. It depends on the use cases.
17.1 How does SUSE Edge use MetalLB? #
SUSE Edge uses MetalLB in two key ways:
As a Load Balancer Solution: MetalLB serves as the Load Balancer solution for bare-metal machines.
For an HA K3s/RKE2 Setup: MetalLB allows for load balancing the Kubernetes API using a Virtual IP address.
In order to be able to expose the API, the endpoint-copier-operator
is used to keep in sync the K8s API endpoints from the 'kubernetes' service to a 'kubernetes-vip' LoadBalancer service.
17.2 Best practices #
Installation of MetalLB in L2 mode is detailed in the MetalLB guide (Chapter 19, MetalLB on K3s (using L2)).
A guide on installing MetalLB in front of the kube-api-server to achieve HA setups can be found in the MetalLB in front of the Kubernetes API server (Chapter 20, MetalLB in front of the Kubernetes API server) tutorial.
17.3 Known issues #
K3S LoadBalancer Solution: K3S comes with its Load Balancer solution,
Klipper
. To use MetalLB, Klipper must be disabled. This can be done by starting the K3s server with the--disable servicelb
option, as described in the K3s documentation.