MetalLB Layer 2 Mode Fails Over a Service IP, It Does Not Spread Traffic

In progress Kubernetes Networking

On bare metal, a Service of type LoadBalancer stays Pending forever: no cloud provider is there to create a load balancer. MetalLB fills the gap by giving the Service an IP from a local pool and making one node answer for it on the LAN with ARP. In Layer 2 mode a single node receives all the traffic for that IP; MetalLB moves the IP when that node fails, but it doesn't share the load between nodes.

How ARP Makes One Node Own the IP

  1. Pool: you give MetalLB addresses on the LAN's subnet, outside the router's DHCP range and away from the nodes' own static IPs.
  2. Assignment: a new LoadBalancer Service gets an IP from the pool.
  3. Election: MetalLB's speakers elect one node to announce that IP.
  4. Gratuitous ARP: the elected node broadcasts "this IP is at my MAC address"; the router and switches update their tables.
  5. Forwarding: traffic arrives on that node, and kube-proxy sends it to the Service's pods on any node.

If the node dies, the other speakers notice, elect a new one, and it announces the IP again: failover in seconds, with no hardware load balancer.

Node IPs and Service IPs Are Different Things

Node static IPs MetalLB pool
Identifies each physical machine, set in the OS an application's entry point
Used by nodes reaching each other and the control plane users reaching a Service

MetalLB doesn't replace static node addresses; it depends on them not colliding with its pool.

Alternatives

  • ServiceLB (Klipper): bundled with K3s, exposes Services on the nodes' own IPs through small proxy pods.
  • kube-vip: a virtual IP for the API server, optionally for LoadBalancer Services too (ARP or BGP).
  • Cilium: a CNI with built-in load balancing based on eBPF.

MicroK8s and Minikube offer MetalLB as an add-on; on kubeadm you install it yourself.

References

Review cards

Flashcard Why does MetalLB's Layer 2 mode fail to spread traffic across nodes for a Service IP?

In Layer 2 mode, only one node owns the Service IP and forwards all traffic for that IP, making it a bottleneck.

Flashcard What does MetalLB's Layer 2 mode use ARP for?

MetalLB's Layer 2 mode uses ARP to announce the Service IP on the LAN, making one node responsible for the IP and its traffic.

Flashcard Why does MetalLB need strictARP: true when kube-proxy runs in IPVS mode?

Otherwise kube-proxy answers ARP for Service IPs itself and competes with MetalLB's elected node. The default iptables mode doesn't need it.