Upgrade metallb load balancer from 0.12.x to 0.13.x
I am running a kubernetes cluster at home to have resiliences for my “homeprod”.
This kubernetes cluster us using metallb to provide loadbalancing, so I can have many pods exposed as a single IP to my local network.
Unfortunately the version I installed in 2022 almost a year ago is using a deprecated feature
PodSecurityPolicy when I noticed this I have started to upgrade the stuff I use to newer versions that uses the new way to handle this security.
Upgrading is not just a drop in replacement unfortunately, since you have to convert your configuration - but that has been made really simple.
This post is a simple guide for others that want to upgrade their metallb installation from 0.12.x to 0.13.7 which the latest version as of todays date.
First you have to convert your old configuration into the new format that metallb uses.
The old version was using a config map, the new version is using custom resources or
My installation has values like these:
- name: default
The guys at metal lb has made a docker container that makes converting really simple.
You simply extract the configmap to a file first:
kubectl get configmap -n metallb-system -o yaml config > config.yaml
Then you run the following
docker run -d -v $(pwd):/var/input quay.io/metallb/configmaptocrs
That docker container reads the config.yaml and outputs a resources in the same folder.
At this point we have converted the configuration to the new format and we can proceed with unistalling the old version.
Uninstall old version
If you installed 0.12.x via helm, you can just do a
helm uninstall metallb metalb/metallb -n <namespace you installed in>
If you did like me and installed via yaml files, you have to do it the dirty way:~
kubectl delete all --all -n metallb-system
At this point you have a cluster thats not working, which is not ideal - but quickly over.
Install new version
So now we have to install the new version.
Add the metallb helm repository if you havent already:
helm repo add metallb https://metallb.github.io/metallb
Then proceed to install the load balancer again, but remember to install into the metal-lb system, otherwise the configurations you extracted above will not work.
helm install metallb metallb/metallb -n metallb-system
At this point metallb is installed, but is still not providing ip addressed from my old pool.
This is fixed by applying the resources.yaml that was created by the
quay.io/metallb/configmaptocrs docker container.
kubectl apply -f resources.yaml - and you should now have a working metallb system using the same up pool as the old system.
I hope you enjoyed this post and if you spot errors, please let me know in the comments below on on email directly.