Installing MetalLB

20 Dec 2021 20:55 raspberry-pi

Installation with Helm, per

Add the repo

helm repo add metallb

Create the values file

My home network is 192.168.28.x, my DHCP server allocates .100 and up, so we’ll use a pool of addresses outside that range.

# values.yaml
   - name: default
     protocol: layer2

Run the installation

helm --namespace metallb-system \
    install --create-namespace \
    metallb metallb/metallb -f values.yaml

Does it work?

$ kubectl create deployment nginx --image=nginx

$ kubectl expose deployment nginx --type=LoadBalancer --port 80

$ kubectl get services
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)        AGE
kubernetes   ClusterIP       <none>          443/TCP        5h53m
nginx        LoadBalancer   80:32580/TCP   117s

$ kubectl scale deployment --replicas=3 nginx

I forgot to disable Klipper, the K3s-provided load balancer. It doesn’t seem to do any harm, but I’ll deal with that later.