Rate This Document
Findability
Accuracy
Completeness
Readability

Uninstalling Kubernetes

Uninstall Kubernetes only when you will not use the Kubernetes cluster. The uninstallation operation is required on all nodes, including the management and compute nodes.

  1. Clear the Kubernetes cluster settings.
    kubeadm reset
  2. Uninstall the management component.
    yum erase -y kubelet kubectl kubeadm kubernetes-cni
  3. Delete the configuration directory.
    [ -d ${HOME}/.kube ] && rm -rf ${HOME}/.kube
    [ -d /etc/cni/net.d ] && rm -rf /etc/cni/net.d
  4. View the bridge information of Flannel and CNI and delete the bridges created by the network plugin.
    1. View the bridge information of Flannel and CNI.
      ip a

      In the command output, the bridges are flannel.1 and cni0.

    2. Delete the bridges.
      ip link set dev flannel.1 down
      ip link set dev cni0 down
      ip link delete flannel.1
      ip link delete cni0
  5. Delete the base component images to uninstall Kubernetes.

    Base components are deployed using Docker images. Therefore, you only need to forcibly delete the images to uninstall Kubernetes.

    docker rmi IMAGE_ID

    IMAGE_ID indicates the ID of the Docker image. You can run the following command to query the ID:

    docker images