Post Image

Microk8s Install MetalLB

MetalLB is a service that runs within your cluster to allow you to load balance traffic directly with Layer 2 or by integrating with BGP so traffic is balanced around the nodes and pods from within your cluster. This post will not get into the nuts and bolts of how it works but rather showing how easy it is to configure on your Microk8s Kubernetes cluster.

Additional resources available and the Microk8s page https://microk8s.io/docs/addon-metallb

 

Prerequisites

A functioning Kubernetes cluster and in addition you will want to install ingress on your cluster and that can be done with the following command.

$ microk8s enable ingress

 

Install MetalLB Across Cluster

The command to install MetalLB is a simple one line. One thing of note is that the IP address range below is the range of IP addresses that I will not be assigning to any other hosts on my kubernetes cluster subnet that will be used when I expose a service to the outside of the cluster. The load balancer will begin to use one of these IP's when I specify a service. You will need to modify the IP addresses to what your network is setup for.

$ microk8s enable metallb:10.204.255.50-10.204.255.254

After that completes, to validate you can do the following to make sure that it has installed properly and is running.

Validate namespace exists

$ microk8s kubectl get namespaces
NAME              STATUS   AGE
metallb-system    Active   2m20s
~output truncated~
$

And validate that the controller and speaker pods are running in that namespace

$ microk8s kubectl get pods -n metallb-system
NAME                         READY   STATUS    RESTARTS   AGE
controller-56c4696b5-v8hrb   1/1     Running   0          3m12s
speaker-9wr4h                1/1     Running   0          3m12s
speaker-xl2fs                1/1     Running   0          3m12s
speaker-8vzcg                1/1     Running   0          3m12s
$

 

And at this point MetalLB is installed and is ready to be further configured. For more detailed documentation on the configuration of MetalLB you can refer to the documentation MetalLB, bare metal load-balancer for Kubernetes (universe.tf).

 

 



Comments (0)
Leave a Comment