Remove Cluster Nodes
This section describes how to delete KubeSphere Enterprise 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 deletion 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 delete nodes. |
Warning |
---|
|
Prerequisites
-
Contact the KubeSphere Enterprise support team to obtain the KubeSphere Enterprise v4.2.0 installation package.
-
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 Enterprise.
Warning If you are unable to get the installation configuration file config-sample.yaml, you need to refer to Install KubeSphere Enterprise 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 Enterprise installation package to a cluster node and log in to the cluster node.
-
Execute the following command to decompress the installation package and enter the directory generated after decompression (replace <package name> with the actual name of the installation package, and replace <directory> with the directory generated after decompression):
tar -zxvf <package name>
cd <directory>
-
Execute the following command to add execution permissions to the KubeKey binary kk:
sudo chmod +x kk
-
Run the following command to get the name of the node that needs to be deleted:
kubectl get node
-
Run the following command to evict the pods running on the node that needs to be deleted to other nodes (replace <node name> with the name of the node that needs to be deleted):
kubectl drain <node name>
-
Transfer the installation configuration file config-sample.yaml to the current directory.
-
Run the following command to start deleting nodes:
./kk delete node <node name> -f config-sample.yaml
-
Run the following command to view the current cluster nodes:
kubectl get node
If the deleted node is not displayed, it means the node is deleted successfully.