Add or Cordon Nodes

Edit

Add a New Node

When you use KubeSphere for a certain time, most likely you need to scale out your cluster with workloads increasing. In this scenario, KubeSphere provides script to add new nodes to the cluster. Fundamentally the operation is based on Kubelet’s registration mechanism, i.e., the new nodes will automatically join the existing Kubernetes cluster.

Please note if the environment is installed with the all-in-one mode, it is not allowed to add new nodes to the single-node cluster.

Step 1: Modify the Host Configuration

KubeSphere supports hybrid environment, which means the newly added host OS can be CentOS or Ubuntu. When a new machine is ready, add a line of parameters about the new machine information in the group all and kube-node of the file conf/hosts.ini. More specifically, please list all nodes under [all] and put the new node under [kube-node] as well. If you are going to add multiple hosts, add corresponding lines of parameters to the file. It is not allowed to modify the host name of the existing nodes (e.g. master, node1, and node2) when you add a new node.

The following section shows adding a new node (i.e. node3) using root user as an example.

  1. [all]
  2. master ansible_connection=local ip=192.168.0.1
  3. node1 ansible_host=192.168.0.2 ip=192.168.0.2 ansible_ssh_pass=PASSWORD
  4. node2 ansible_host=192.168.0.3 ip=192.168.0.3 ansible_ssh_pass=PASSWORD
  5. node3 ansible_host=192.168.0.4 ip=192.168.0.4 ansible_ssh_pass=PASSWORD
  6. ···
  7. [kube-node]
  8. node3
  9. ···

Note: You need to turn off firewall yourself for new nodes.

Step 2: Execute the script

Execute the add-nodes.sh script in the scripts directory.

  1. ./add-nodes.sh

Finally, you will be able to see the new node information on the KubeSphere console after a successful return. Select Infrastructure → Nodes from the left menu, or using kubectl get node command can also see the changes.

Cordon a Node

Similarly, if you need to cordon or suspend nodes in the cluster for some reasons, such as hardware upgrades, hardware maintenance, etc., you can choose Infrastructure → Nodes from the menu, then click the Cordon button. Please see Node Management for further information.

Cordon Node