Add Cluster Nodes
This section describes how to add KubeSphere cluster nodes.
The open-source tool KubeKey will be used during the process. For more information about KubeKey, please visit GitHub KubeKey repository.
| Note |
|---|
The node addition method described in this section is only applicable to Kubernetes installed through KubeKey. If your Kubernetes is not installed via KubeKey, please refer to Kubernetes Documentation to add nodes. |
Prerequisites
-
The operating system and version of the cluster nodes must be Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, Debian 9, Debian 10, CentOS 7, CentOS Stream, RHEL 7, RHEL 8, SLES 15, openSUSE Leap 15, or Kylin v10. The operating systems of multiple servers can be different. For support of other operating systems and versions, please consult QingCloud’s official solution experts or delivery service experts.
-
In a production environment, to ensure the cluster has sufficient computing and storage resources, it is recommended that each cluster node be configured with at least 8 CPU cores, 16 GB of memory, and 200 GB of disk space. In addition, it is recommended to mount an additional 200 GB of disk space in the /var/lib/docker (for Docker) or /var/lib/containerd (for containerd) directory of each cluster node for storing container runtime data.
-
In a production environment, it is recommended to configure high availability for the KubeSphere cluster in advance to avoid service interruption in the event of a single control plane node failure. For more information, please refer to the Configure High Availability.
-
If your cluster nodes cannot connect to the Internet, you also need to prepare a Linux server to create a image registry, and this server must be connected to the KubeSphere cluster node network, with at least 100 GB of disk space mounted in the /mnt/registry directory.
-
You should get the installation configuration file config-sample.yaml and transfer it to the cluster node where you will perform this action. For more information, refer to Install KubeSphere.
Warning -
During the process of adding nodes, it is not allowed to modify the original cluster configuration in config-sample.yaml.
-
If you are unable to get the installation configuration file config-sample.yaml, you need to refer to Install KubeSphere to recreate the config-sample.yaml file. When recreating the file, make sure that the cluster information in the file matches the current state of the cluster. Otherwise, the uninstallation process may encounter errors.
-
Steps
-
Transfer the KubeSphere installation package to any cluster node and log in to that node.
-
Execute the following commands to extract the installation package and navigate to the directory generated after extraction (replace
<package name>with the actual name of the installation package and<directory>with the directory generated after extraction):tar -zxvf <package name>cd <directory> -
Execute the following command to add execute permission to the KubeKey binary file kk:
sudo chmod +x kk -
Transfer the installation configuration file config-sample.yaml to the current directory.
-
Run the following command to edit the installation configuration file config-sample.yaml:
vi config-sample.yaml -
Configure the information of the new node under the hosts parameter in config-sample.yaml.
Parameter Description name
The user-defined server name.
address
The SSH login IP address of the server.
internalAddress
The internal IP address of the server within the subnet.
port
The SSH port number of the server. If using the default port 22, this parameter can be omitted.
user
The SSH login username for the server. This user must be the root user or another user with sudo command execution privileges. If using the root user, this parameter can be omitted.
password
The SSH login password for the server. If privateKeyPath is already set, this parameter can be omitted.
privateKeyPath
The path to the SSH login private key for the server. If password is already set, this parameter can be omitted.
arch
The hardware architecture of the server. If the server’s hardware architecture is arm64, set this parameter to arm64; otherwise, do not set it. The installation package by default only supports scenarios where all cluster nodes are of x86_64 or arm64 architecture. If the hardware architecture of cluster nodes is not identical, technical assessment is required for the specific situation. Please consult QingCloud official solution experts or delivery service experts.
Warning Please do not modify the information of the original node. Otherwise, the cluster may encounter errors after adding nodes.
-
Configure the role of the new node in the cluster under the roleGroups parameter in config-sample.yaml.
Parameter Description etcd
Nodes for installing the etcd database. Set the cluster control plane nodes under this parameter.
control-plane
Cluster control plane nodes. If you have configured high availability for the cluster, you can set multiple control plane nodes.
worker
Cluster worker nodes.
registry
Server used to create a private image service. This server will not be used as a cluster node. When installing or upgrading KubeSphere, if the cluster nodes cannot connect to the internet, you need to set the server used to create a private image service under this parameter. In other cases, please comment out this parameter.
Warning Please do not modify the role of the original node. Otherwise, the cluster may encounter errors after adding nodes.
-
If a new control plane node is added and the current cluster is not configured for high availability, configure the high availability information under the controlPlaneEndpoint parameter in config-sample.yaml.
Parameter Description internalLoadbalancer
The type of the local load balancer. If using a local load balancer configuration, set this parameter to haproxy. Otherwise, comment out this parameter.
domain
The internal access domain name of the load balancer. Set this parameter to lb.kubesphere.local.
address
The IP address of the load balancer. If using a local load balancer configuration, leave this parameter empty; if using a dedicated load balancer, set this parameter to the IP address of the load balancer; if using a general server as a load balancer, set this parameter to the floating IP address of the load balancer.
port
The port number the load balancer listens on, which is the port number of the apiserver service. Set this parameter to 6443.
Warning -
If the current cluster has been configured with high availability, do not modify the high availability information in the config-sample.yaml file. Otherwise, the cluster may encounter errors after adding nodes.
-
If the current cluster uses local load balancing to achieve high availability, you do not need to perform any operations on cluster high availability; if the current cluster uses a load balancer to achieve high availability, you only need to configure the load balancer to listen on port 6443 of all control plane nodes. For more information, see Configure High Availability.
-
-
Save the configuration file and run the following command to start adding nodes:
./kk add nodes -f config-sample.yaml -a kubekey-artifact.tar.gz -
Run the following command to view the nodes of the current cluster:
kubectl get nodeIf it displays the information about the new node, it means the node is added successfully.