Uninstall Kubernetes and KubeSphere

This section explains how to uninstall Kubernetes and KubeSphere.

Note

The uninstallation method for Kubernetes described in this section only applies to Kubernetes installed using KubeKey. If your Kubernetes is not installed through KubeKey, please refer to the Kubernetes Documentation for uninstallation instructions.

Warning

The uninstallation will cause business interruption to the KubeSphere cluster and cannot be undone. Please proceed with caution.

Prerequisites

  • You should get the installation configuration file config-sample.yaml and transfer it to the cluster nodes where you will perform the uninstallation. For more information, refer to Install Kubernetes and KubeSphere.

    Note

    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.

  • To avoid data loss, please back up all important data in advance.

Steps

  1. 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:

    1. export KKZONE=cn
  2. Run the following command to download the latest version of KubeKey:

    1. 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.

  3. Add execute permission to the KubeKey binary file kk:

    1. sudo chmod +x kk
  4. Transfer the installation configuration file config-sample.yaml to the current directory.

  5. Run the following command to uninstall KubeSphere.

    1. ./kk delete cluster -f config-sample.yaml

    If you see the following message, it means the uninstallation is successful:

    1. Pipeline[DeleteClusterPipeline] execute successful