Remove Cluster Nodes
This section describes how to delete 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 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
-
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 Kubernetes and KubeSphere.
Warning |
---|
If you are unable to get the installation configuration file config-sample.yaml, you need to refer to Install Kubernetes and 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
-
If you are accessing GitHub/Googleapis from a restricted location, please log in to any cluster node and run the following command to set the download region:
export KKZONE=cn
-
Run the following command to download the latest version of KubeKey:
curl -sfL https://get-kk.kubesphere.io | sh -
After the download is complete, a KubeKey binary file kk will be generated in the current directory.
Note If the cluster node used to perform the operations cannot connect to the internet, you can manually download KubeKey on a device with internet access and then transfer it to the cluster node.
-
Add execute permission to the KubeKey binary file kk:
sudo chmod +x kk
-
Execute the following command to get the name of the node that needs to be deleted:
kubectl get node
-
Execute 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.
-
Execute the following command to start deleting nodes:
 ./kk delete node <node name> -f config-sample.yaml
-
Execute 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.
Feedback
Was this page Helpful?
Receive the latest news, articles and updates from KubeSphere
Thanks for the feedback. If you have a specific question about how to use KubeSphere, ask it on Slack. Open an issue in the GitHub repo if you want to report a problem or suggest an improvement.