Adding and Removing Nodes in Cluster
Guide to Adding and Removing Nodes from an Existing Kubernetes Cluster
Adding Nodes to Cluster
Below are the steps to add new nodes to an existing Kubernetes cluster.
From kubernetes/rke2 directory, use the
rke2-server.conf.subsequent.templateorrke2-agent.conf.templatebased on whether the new node is control plane node or worker node. Copy this file to/etc/rancher/rke2/config.yamlin the new node.Configure the config.yaml with relevant values.
Run the following to set the RKE2 version. Make sure this version is the same across all the nodes. (Refer to RKE2 Releases. Use
rke2 --versionon an existing node to get the version.)export INSTALL_RKE2_VERSION="v1.35.8+rke2r1"Run the below command to download RKE2.
curl -sfL https://get.rke2.io | sh -Run the below commands to start RKE2 node.
systemctl enable rke2-server systemctl start rke2-server
Deleting Nodes from Cluster
Follow the steps below to remove a node from the Kubernetes cluster.
Before you delete the node, make sure the PodDisruptionBudget is set to "0" on deleting node. Click here for more information.
To drain the node from the cluster, run the command below.
Once done draining the node, run the command below to delete it from the cluster.
After deleting the node, check your Kubernetes cluster to ensure the node has been deleted.
Make sure the node IP is removed from the LoadBalancer/NGINX to avoid intermittent issues in the environment.
Last updated
Was this helpful?