Updating Loadbalancer IP with Microk8s and Metallb

While using Metallb add-on in microk8s certainly makes life easy, what happens if you make a mistake with your original IP address configuration and you would like to physically assign an IP from a new IP range?

The answer is to use custom address pool. The details of which can be found on the microk8s add-on page.

In short you can add the following yaml to your cluster:

apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: custom-addresspool
  namespace: metallb-system
spec: 
  addresses:
  - 192.168.1.1-192.168.1.100

Now that the new IP Address pool has been loaded into the kube, the final step is to point the ingress Loadbalancer to the desired address. You can edit the Loadbalancer by adding these two lines to the config:

  1. This line under annotations

  2. The loadBanacerIP in the spec, as seen below.

metadata:
  annotations:
    metallb.universe.tf/address-pool: custom-addresspool
spec:
  selector:
    name: nginx
  type: LoadBalancer
  loadBalancerIP: 192.168.1.100

In your utopia-ingress-nginx-controller it might look something like this once added:

This should help you assign the new IP address to your loadbalancer.

Last updated