Bobcares

How to Add Nodes in MicroK8s on Raspberry Pi

PDF Header PDF Footer

Step-by-step guide to Add Nodes MicroK8s on Raspberry Pi with Ubuntu 20.04. Our Kubernetes support team is always here to help you.

How to Add Nodes in MicroK8s on Raspberry Pi

Add Nodes MicroK8sIf you’re running MicroK8s on Raspberry Pi and looking to scale your cluster, this post on autoscaling walks you through how to Add Nodes MicroK8s step-by-step. Adding new nodes increases compute power and brings redundancy, making your Kubernetes cluster more reliable and available.

Here’s how to add a Raspberry Pi (RPi) node running Ubuntu 20.04 to your existing MicroK8s cluster.

Step 1: Generate Join Command on Main Node

Start by connecting to the main RPi node (the control plane) and run:

ubuntu@ubuntu:~$ microk8s add-node
Join node with: microk8s join 192.168.178.66:25000/ipySurdsIOGAlYyYQzzOOSlpUTEDNGfk
If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 192.168.178.66:25000/ipySurdsIOGAlYyYQzzOOSlpUTEDNGfk
microk8s join 10.1.79.0:25000/ipySurdsIOGAlYyYQzzOOSlpUTEDNGfk
microk8s join 172.17.0.1:25000/ipySurdsIOGAlYyYQzzOOSlpUTEDNGfkCopy Code

This command outputs a join token unique to your cluster.

Step 2: Prepare the New Node

Before you Add Nodes MicroK8s, ensure MicroK8s is installed on the second Raspberry Pi and update the hostname:

  • Edit /etc/hostname and give it a unique name (e.g., ubuntu-2)
  • Edit /etc/hosts and update the hostname accordingly
  • Reboot:
sudo rebootCopy Code

Step 3: Join the Cluster

Now SSH into the second RPi and run the join command from Step 1:

ubuntu@ubuntu-2:~$ microk8s join 192.168.178.66:25000/ipySurdsIOGAlYyYQzzOOSlpUTEDNGfkCopy Code

Check the node status from the main node:

ubuntu@ubuntu:~$ microk8s.kubectl get nodes
NAME       STATUS     ROLES    AGE   VERSION
ubuntu     Ready      <none>   59d   v1.18.3
ubuntu-2   NotReady   <none>   98s   v1.18.3Copy Code

If you see NotReady, the memory cgroup is likely disabled or you may encounter an error occurred forwarding.

Step 4: Enable cgroup Memory Support

Check current cgroup status:

ubuntu@ubuntu-2:~$ sudo cat /proc/cgroupsCopy Code

Look for this line:

memory  0   56  0Copy Code

To fix it, edit the boot config file:

sudo nano /boot/firmware/cmdline.txtCopy Code

Add the following at the end of the line:

cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1Copy Code

Reboot the node:

ubuntu@ubuntu-2:~$ sudo rebootCopy Code

After reboot, verify the fix:

ubuntu@ubuntu-2:~$ cat /proc/cgroupsCopy Code

You should now see:

memory  9   101 1Copy Code

Step 5: Confirm Cluster Status

Back on the main node, check again: https://bobcares.com/blog/kubernetes-cronjob-resource-limits/

ubuntu@ubuntu:~$ microk8s.kubectl get nodes
NAME STATUS ROLES AGE VERSION
ubuntu Ready <none> 59d v1.18.3
ubuntu-2 Ready <none> 4h12m v1.18.3Copy Code

Summary

To Add Nodes MicroK8s, follow these steps:

  • Run microk8s add-node on the main node.
  • Configure and rename your new node.
  • Run microk8s join with the token.
  • Enable memory cgroups.
  • Reboot and verify.

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

This method works perfectly with Raspberry Pi setups and Ubuntu 20.04. Now you can scale confidently with MicroK8s!

Add Nodes MicroK8s is simple, effective, and powerful when you get the details right.

0 Comments

Submit a Comment

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

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!