Metallb Setup on Minikube

Debankur Saha | Jun 22, 2022 min read

Setting up Metallb on Minikube

Minikube can help spin up a cluster of VMs quickly to run kubernetes on. But the major pain point is getting the LoadBalancer to be setup since that is typically setup by default on cloud providers

Reference: The details published in the article have been derived from the following post

https://kubebyexample.com/en/learning-paths/metallb/install

Step 1:

I have launched minikube as a 4 node cluster with 32 GB RAM and 4 CPUs

NAME           STATUS   ROLES                  AGE   VERSION
minikube       Ready    control-plane,master   44m   v1.22.9
minikube-m02   Ready    <none>                 44m   v1.22.9
minikube-m03   Ready    <none>                 44m   v1.22.9
minikube-m04   Ready    <none>                 44m   v1.22.9

Step 2:

Check the addons status using

minikube addons list
|-----------------------------|----------|--------------|--------------------------------|
|         ADDON NAME          | PROFILE  |    STATUS    |           MAINTAINER           |
|-----------------------------|----------|--------------|--------------------------------|
| ambassador                  | minikube | disabled     | third-party (ambassador)       |
| auto-pause                  | minikube | disabled     | google                         |
| csi-hostpath-driver         | minikube | disabled     | kubernetes                     |
| dashboard                   | minikube | disabled     | kubernetes                     |
| default-storageclass        | minikube | enabled ✅   | kubernetes                     |
| efk                         | minikube | disabled     | third-party (elastic)          |
| freshpod                    | minikube | disabled     | google                         |
| gcp-auth                    | minikube | disabled     | google                         |
| gvisor                      | minikube | disabled     | google                         |
| helm-tiller                 | minikube | disabled     | third-party (helm)             |
| ingress                     | minikube | disabled     | unknown (third-party)          |
| ingress-dns                 | minikube | disabled     | google                         |
| istio                       | minikube | disabled     | third-party (istio)            |
| istio-provisioner           | minikube | disabled     | third-party (istio)            |
| kong                        | minikube | disabled     | third-party (Kong HQ)          |
| kubevirt                    | minikube | disabled     | third-party (kubevirt)         |
| logviewer                   | minikube | disabled     | unknown (third-party)          |
| metallb                     | minikube | disabled     | third-party (metallb)          |
| metrics-server              | minikube | disabled     | kubernetes                     |
| nvidia-driver-installer     | minikube | disabled     | google                         |
| nvidia-gpu-device-plugin    | minikube | disabled     | third-party (nvidia)           |
| olm                         | minikube | disabled     | third-party (operator          |
|                             |          |              | framework)                     |
| pod-security-policy         | minikube | disabled     | unknown (third-party)          |
| portainer                   | minikube | disabled     | portainer.io                   |
| registry                    | minikube | disabled     | google                         |
| registry-aliases            | minikube | disabled     | unknown (third-party)          |
| registry-creds              | minikube | disabled     | third-party (upmc enterprises) |
| storage-provisioner         | minikube | enabled ✅   | google                         |
| storage-provisioner-gluster | minikube | disabled     | unknown (third-party)          |
| volumesnapshots             | minikube | disabled     | kubernetes                     |
|-----------------------------|----------|--------------|--------------------------------|

Step 3:

Check the Minikube IP using

minikube ip

In my case it is

192.168.49.2

Enable Metallb:

minikube addons enable metallb
    ▪ Using image metallb/controller:v0.9.6
    ▪ Using image metallb/speaker:v0.9.6
🌟  The &apos;metallb&apos; addon is enabled
</pre>

Configure Metallb using

minikube addons configure metallb
-- Enter Load Balancer Start IP: 192.168.49.50
-- Enter Load Balancer End IP: 192.168.49.100
    ▪ Using image metallb/speaker:v0.9.6
    ▪ Using image metallb/controller:v0.9.6
✅  metallb was successfully configured

Step 4:

List all resources in the metallb-system namespace

NAME                              READY   STATUS    RESTARTS   AGE
pod/controller-66bc445b99-nm5x7   1/1     Running   0          3m58s
pod/speaker-6lrkz                 1/1     Running   0          3m58s
pod/speaker-lx8x7                 1/1     Running   0          3m58s
pod/speaker-tdbgj                 1/1     Running   0          3m58s
pod/speaker-x9gnr                 1/1     Running   0          3m58s

NAME                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                 AGE
daemonset.apps/speaker   4         4         4       4            4           beta.kubernetes.io/os=linux   3m58s

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/controller   1/1     1            1           3m58s

NAME                                    DESIRED   CURRENT   READY   AGE
replicaset.apps/controller-66bc445b99   1         1         1       3m58s

In the next step we will deploy a dummy application and test the LoadBalancer