MetalLB is a load-balancer implementation for bare metal Kubernetes clusters, using standard routing protocols.

Why?

Kubernetes does not offer an implementation of network load balancers (Services of type LoadBalancer) for bare-metal clusters. The implementations of network load balancers that Kubernetes does ship with are all glue code that calls out to various IaaS platforms (GCP, AWS, Azure…). If you’re not running on a supported IaaS platform (GCP, AWS, Azure…), LoadBalancers will remain in the “pending” state indefinitely when created.

Bare-metal cluster operators are left with two lesser tools to bring user traffic into their clusters, “NodePort” and “externalIPs” services. Both of these options have significant downsides for production use, which makes bare-metal clusters second-class citizens in the Kubernetes ecosystem.

MetalLB aims to redress this imbalance by offering a network load balancer implementation that integrates with standard network equipment, so that external services on bare-metal clusters also “just work” as much as possible.

Requirements

MetalLB requires the following to function:

  • A Kubernetes cluster, running Kubernetes 1.13.0 or later, that does not already have network load-balancing functionality. You could deploy by kubeadm.
  • A cluster network configuration that can coexist with MetalLB.
  • Some IPv4 addresses for MetalLB to hand out.
  • When using the BGP operating mode, you will need one or more routers capable of speaking BGP.
  • When using the L2 operating mode, traffic on port 7946 (TCP & UDP, other port can be configured) must be allowed between nodes, as required by memberlist.

Installation With Helm

You can install MetallLB with Helm by using the Helm chart repository: https://metallb.github.io/metallb

helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb

A values file may be specified on installation. This is recommended for providing configs in Helm values:

helm install metallb metallb/metallb -f values.yaml

Reference List

  1. https://www.youtube.com/watch?v=Yl8JKffmhuE&ab_channel=VirtualizationHowto