-->

DEVOPSZONES

  • Recent blogs

    How to Completely remove Kubernetes

    How to Completely remove Kubernetes


    kubernetes


      We need to reset our Cluster. We will delete the containers first. If the containers are running please stop them before removing.

    docker rm `docker ps -a -q` -f

      Now we will delete the images.

      [root@kubernetesmaster ~]# docker rmi `docker images -q`
    Untagged: k8s.gcr.io/kube-proxy:v1.17.0

    kubeadm reset


    "kubeadm reset" command reverts any changes made by kubeadm init or kubeadm join commands. Also you should know, that this command will not delete any data from etcd. So if you want to initialize your Kubernetes master node again just type kubeadm init.

    [root@kubernetesmaster ~]# kubeadm reset
    [reset] WARNING: changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
    [reset] are you sure you want to proceed? [y/N]: y
    [preflight] running pre-flight checks
    [reset] stopping the kubelet service
    [reset] unmounting mounted directories in "/var/lib/kubelet"
    [reset] deleting contents of stateful directories: [/var/lib/kubelet /etc/cni/net.d /var/lib/dockershim /var/run/kubernetes /var/lib/etcd]
    [reset] deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
    [reset] deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
    [root@kubernetesmaster ~]#

    Interesting Articles on Kubernetes:

    Kubernetes : Kubernetes Node Management, Maintenance, Delete
    How to add a  New Worker Node to a existing kubernetes Cluster
    MinIO Client Installation and Quickstart
    Backup MySQL databases in Kubernetes
    How to Run Automated Tasks in Kubernetes with a cronjob


    Now we are free to remove packages that we don’t need any more. 


    "yum remove kubeadm kubectl kubelet kubernetes-cni kube* " 

    root@kubernetesmaster ~]# yum remove kubeadm kubectl kubelet kubernetes-cni kube* -y
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    No Match for argument: kubeadm-config.yaml
    No Match for argument: kubeadm-ha
    No Match for argument: kubecertback201219
    No Match for argument: kubernetesconfigbackup
    No Match for argument: kube-scheduler.log
    Resolving Dependencies
    --> Running transaction check
    ---> Package kubeadm.x86_64 0:1.12.0-0 will be erased
    ---> Package kubectl.x86_64 0:1.12.0-0 will be erased
    ---> Package kubelet.x86_64 0:1.12.0-0 will be erased
    ---> Package kubernetes-cni.x86_64 0:0.6.0-0 will be erased
    --> Finished Dependency Resolution

    Lets remove packages that has not dependencies and can be removed from machine. "yum autoremove" tries to remove any packages that waren’t installed explicitly by the user and which aren’t required.

    [root@kubernetesmaster ~]# yum autoremove
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    Resolving Dependencies
    --> Running transaction check
    ---> Package atomic-registries.x86_64 1:1.22.1-26.gitb507039.el7 will be erased
    ---> Package conntrack-tools.x86_64 0:1.4.4-5.el7_7.2 will be erased
    ---> Package container-storage-setup.noarch 0:0.11.0-2.git5eaf76c.el7 will be erased
    ---> Package containers-common.x86_64 1:0.1.31-7.gitb0b750d.el7 will be erased
    ---> Package cri-tools.x86_64 0:1.12.0-0 will be erased
    ---> Package docker-rhel-push-plugin.x86_64 2:1.13.1-96.gitb2f74b2.el7 will b

    Remove Docker Also.

    We should delete folder that located, by default, in home directory and contain some config files.

    # docker rm `docker ps -a -q`
    # docker rmi `docker images -q`
    # kubeadm reset
    # yum remove kubeadm kubectl kubelet kubernetes-cni kube* 
    # yum autoremove
    # rm -rf ~/.kube


    No comments