Add Worker Nodes to the Cluster

The Kubernetes cluster might run out of resources when handling large workloads. In these cases, adding an extra node to the cluster can help manage the increased workloads.

Add a Worker Node

Note: Do not add a worker node during the cluster upgrade. However, you can add the worker node after the upgrade is successful.
  1. Run the following command on the cluster:
    appdctl cluster add-node

    This command generates a command to add the worker node to the cluster.

    The following is a sample output:

    Sample Output

    Enter the following command on the node as master to join the cluster:
    appdctl cluster join 10.X.X.X:25000/11c4d3d1234288c8d7135ce470aeb9e8/b3f373551c9b
    Enter the following command on the node as worker to join the cluster:
    appdctl cluster join 10.X.X.X:25000/11c4d3d1234288c8d7135ce470aeb9e8/b3f373551c9b --worker
  2. Run the command that has the --worker flag in the node that you want to join to the cluster.

    For example:

    appdctl cluster join 10.X.X.X:25000/11c4d3d1234288c8d7135ce470aeb9e8/b3f373551c9b --worker
  3. Verify whether the cluster includes the worker node:
    appdctl show cluster
    microk8s status

    Sample Output

    NODE           | ROLE  | RUNNING
    ----------------+-------+---------
    10.0.0.1:19001 | voter | true
    10.0.0.2:19001 | voter | true
    10.0.0.3:19001 | voter | true
    10.0.0.4:19001 | voter | true
Note: After you add a node to the cluster, restart the cluster for the node to take effect.

Delete the Worker Nodes

You can delete the worker nodes if they are not required. Complete the following steps to delete the worker nodes:

  1. This command prevents the node from scheduling workloads.Run the drain command on the node.
    kubectl drain <Node_Name> - -ignore-daemonsets --delete-emptydir-data

    This command prevents the node from scheduling workloads.

  2. Delete the node.
    kubectl delete node <Node_Name>

    This command removes the worker node from the cluster.