If you are struggling to install MetalLB in Kubernetes with the newest versions of MetalLB, there are some changes that you need to know. With 0.13.x and higher, there are now two requirements instead of one during the installation.
You need to create:
- ipaddresspools
- l2advertisements
First, let's install MetalLB. You can use the script here for the latest 0.14.3 (at the time of this post): raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml
Previously, the L2 advertisement was not needed. What do these YAML files need to contain and what do they look like?
Below is a sampleย ipaddresses.yml file. Replace the IP addresses needed in your environment.
apiVersion: metallb.io/v1beta1 kind: IPAddressPool metadata: name: first-pool namespace: metallb-system spec: addresses: - 10.1.149.240-10.1.149.250
Below is a sampleย layer2.ymlย file. The metadata name needs to match the metadata name in the ipaddresses.yml file.
apiVersion: metallb.io/v1beta1 kind: L2Advertisement metadata: name: first-pool namespace: metallb-system
Run the following commands after creating the files. You will note below, the files exist in /tmp, so replace with the path to your files:
kubectl create -f /tmp/ipaddresspool.yml kubectl create -f /tmp/l2advertisements.yml
That should be it. After creating the ipaddresses and l2advertisement, you should be able to receive an IP address for your Kubernetes services.
Let me know if you have any questions.
ย