All HowTo's Kubernetes & Docker

Kubernetes (MicroK8s) Part 4 – Microk8s in High Availability

The good news is that Microk8s can now be deployed in a multi-node architecture. And it’s simple to do. This video “” is a nice demonstration.

It uses a floating IP between the cluster nodes that removes the need to use a load balancer in front of your cluster.

Start with the installation. Do this on each of the nodes. I’m using a 3 mode cluster but that’s not important, just do the same, one step at a time, on each node:

sudo snap install microk8s --classic --channel=1.19/stable

Now we need to join the nodes into a cluster. We need to pick one node (it doesn’t matter which) and run the following command on it. Run the following command once for each node that needs to be joined. The command presents some output that you can use to paste into the console “one” other node resulting in that node joining the cluster. Do this once for each node. You can’t use the same output for two nodes.

microk8s add-node

The above command takes a minute or so to complete.

One one of the nodes, run the following command to enable add-ons:

sudo microk8s enable dashboard dns registry istio

Now add the HA floating IP add-on:

microk8s enable metallb

Note: The above command will result in a question about which IP range you want to use for the floating IP.

Now that everything is done, run the following command on any of them to see the current HA status. You should also see that your add-ons have been enabled on all cluster members:

sudo microk8s status

And you should see something like this (with more text that follows):

microk8s is running
high-availability: yes
  datastore master nodes:
  datastore standby nodes: none

The “HA” status should be “yes” and you should also have a floating IP address. Ie, an address that will belong to just one of the nodes until it becomes unavailable – at which time another node will assume the role.

To get the floating IP and other details, run the following command:

sudo microk8s.kubectl get all -A

You will only get the floating IP if you have applications listening/running in your cluster.

Leave a Reply

Your email address will not be published. Required fields are marked *