Ubuntu 24.04
Sponsored Link

MicroK8s : Add Nodes2024/06/14

 

If you'd like to add more Nodes to your MicroK8s Cluster, Configure like follows.

[1] Make sure commands to join in Cluster on primary Node.
root@dlp:~#
microk8s add-node

From the node you wish to join to this cluster, run the following:
microk8s join 10.0.0.30:25000/ab8374269e5e7ffa20cc51b7e79b8986/0ab70ce72574

Use the '--worker' flag to join a node as a worker not running the control plane, eg:
microk8s join 10.0.0.30:25000/ab8374269e5e7ffa20cc51b7e79b8986/0ab70ce72574 --worker

If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 10.0.0.30:25000/ab8374269e5e7ffa20cc51b7e79b8986/0ab70ce72574
[2] On a new Node, Install MicroK8s and join in Cluster.
Just enter the command as shown on the primary node.
If you want to add it as a Worker node, add the [--worker] option.
root@node01:~#
snap install microk8s --classic

microk8s (1.29/stable) v1.29.4 from Canonical✓ installed
# run the command confirmed in [1]

root@node01:~#
microk8s join 10.0.0.30:25000/ab8374269e5e7ffa20cc51b7e79b8986/0ab70ce72574 --worker

Contacting cluster at 10.0.0.30

The node has joined the cluster and will appear in the nodes list in a few seconds.

This worker node gets automatically configured with the API server endpoints.
If the API servers are behind a loadbalancer please set the '--refresh-interval' to '0s' in:
    /var/snap/microk8s/current/args/apiserver-proxy
and replace the API server endpoints with the one provided by the loadbalancer in:
    /var/snap/microk8s/current/args/traefik/provider.yaml

Successfully joined the cluster.
[3] After a few minutes on primary Node, Make sure a new Node has been added in Cluster.
root@dlp:~#
microk8s kubectl get nodes

NAME               STATUS   ROLES    AGE    VERSION
dlp.srv.world      Ready    <none>   33m    v1.29.4
node01.srv.world   Ready    <none>   117s   v1.29.4
[4] To remove a Node, Set like follows.
# leave from cluster on the target node first

root@node01:~#
microk8s leave

Configuring services.
Generating new cluster certificates.
Waiting for node to start.
# on primary node, remove the target node

root@dlp:~#
microk8s remove-node node01.srv.world
root@dlp:~#
microk8s kubectl get nodes

NAME            STATUS   ROLES    AGE   VERSION
dlp.srv.world   Ready    <none>   35m   v1.29.4
Matched Content