Using MetalLB CRDs

3 Apr 2023 15:33 kubernetes metallb

When I originally installed MetalLB, it used a ConfigMap for setting up address ranges. Since 0.13.2, it supports configuration using Custom Resource Definitions (CRDs). I forgot to write a blog post about that when I upgraded.

The IPAddressPool looks like this:

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: default
  namespace: metallb-system
spec:
  addresses:
  - 192.168.28.60-192.168.28.90

If you’re using ARP for address discovery, you’ll need an L2Advertisement as well:

apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: default
  namespace: metallb-system

It works because both the IPAddressPool and L2Advertisement are named “default”.