MicroK8s provides an easy way to create lightweight Kubernetes clusters. This guide explains how to join a new node as a worker in an existing MicroK8s cluster using the --worker flag.
Run the following command to generate a join token:
microk8s add-nodeThis will output something like:
From the node you wish to join to this cluster, run the following:
microk8s join 192.168.1.100:25000/bc8c3e4fa837de1d5c4e2a7b8f...
Take note of the generated command.
These ports needs to be allowed for communication,
sudo ufw allow 25000 comment "Nodes-Connect"
sudo ufw allow 10250 comment "Kubelet"
sudo ufw allow 16443 comment "Kubernetes Dashboard"Run the microk8s join command provided in Step 1, but append the --worker flag:
microk8s join 192.168.1.100:25000/bc8c3e4fa837de1d5c4e2a7b8f... --workerReplace 192.168.1.100:25000/... with the actual address and token from Step 1.
Using the --worker flag ensures the node is joined as a worker, meaning it will not run control plane services.
After joining, go back to the control plane and check the node status:
microk8s kubectl get nodesYou should see the new node listed as Ready with a worker role.
If you need to remove a node from the cluster, run this command on the control plane:
microk8s remove-node <node-name>- Ensure all nodes are running the same MicroK8s version.
- If the worker node has firewall rules, allow communication on port 25000.
- Nodes might take a few minutes to be fully integrated into the cluster.
- The control plane nodes handle the cluster management, while worker nodes only run workloads.
⚠️ Warning: Ubuntu 24 Networking CompatibilityUbuntu 24 now uses:
systemd-networkdnetfilter/nftables (nft)as the default firewall backendHowever, MicroK8s with Calico (especially VXLAN or BGP backends) expects
iptables-legacyor at least fulliptables/nftcompatibility.This mismatch can cause pod networking issues, such as:
- Pods failing to reach external services (e.g., SQL Server)
- Errors like
System.Net.Sockets.SocketException: Resource temporarily unavailable✅ Fix: Either turn off Ufw Firewall OR Switch to the legacy iptables backend:
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy sudo update-alternatives --set arptables /usr/sbin/arptables-legacy sudo update-alternatives --set ebtables /usr/sbin/ebtables-legacy sudo microk8s stop && sudo microk8s startThis ensures full Calico compatibility and restores stable pod networking.
Feel free to also check this out https://gist.github.com/swagfin/d425b6ab36034a1aae8f22465ad6b228