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-node
This 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.
Run the microk8s join
command provided in Step 1, but append the --worker
flag:
microk8s join 192.168.1.100:25000/bc8c3e4fa837de1d5c4e2a7b8f... --worker
Replace 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 nodes
You 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.
Now you're ready to scale your MicroK8s cluster with dedicated worker nodes! 🚀
Feel free to also check this out https://gist.github.com/swagfin/d425b6ab36034a1aae8f22465ad6b228