Post

kubekey删除集群

kubekey删除集群

删除集群

参考链接

1
[root@harbor kubesphere]# ./kk delete cluster -f config-sample.yaml

kubeadm 重置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@master1 ~]#  kubeadm reset

[reset] Reading configuration from the cluster...
[reset] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
W0605 16:48:04.702064   45541 utils.go:69] The recommended value for "clusterDNS" in "KubeletConfiguration" is: [10.233.0.10]; the provided value is: [169.254.25.10]
[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
The 'update-cluster-status' phase is deprecated and will be removed in a future release. Currently it performs no operation
W0605 16:48:07.330075   45541 removeetcdmember.go:80] [reset] No kubeadm config, using etcd pod spec to get data directory
[reset] No etcd config found. Assuming external etcd
[reset] Please, manually reset etcd to prevent further issues
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[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]
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /var/lib/dockershim /var/run/kubernetes /var/lib/cni]
The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d
The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command.
If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.
The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.

删除挂载点

1
2
df -h | grep container
umount xxxxxxx

删除k8s

1
2
3
4
5
6
7
8
systemctl stop kubelet
systemctl stop etcd
systemctl stop docker

yum list installed | grep kube
yum -y remove kube*
yum list installed | grep kube
yum list installed | grep kube

删除docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sudo systemctl stop docker
sudo systemctl stop docker.socket

sudo yum remove -y docker-engine docker docker.io docker-ce
sudo systemctl stop docker.socket
sudo yum remove -y docker-engine docker docker.io docker-ce

sudo rm -rf /var/lib/docker
sudo rm -rf /etc/docker
sudo rm -rf /run/docker
sudo rm -rf /var/run/docker
sudo rm -rf /var/lib/dockershim
sudo rm -rf /var/lib/containerd
sudo rm -rf /var/lib/docker-engine

sudo rm -rf /etc/systemd/system/docker.service
sudo rm -rf /etc/systemd/system/docker.socket
sudo rm -rf /usr/lib/systemd/system/docker.service
sudo rm -rf /usr/lib/systemd/system/docker.socket
sudo rm -rf /etc/default/docker
sudo rm -rf /etc/sysconfig/docker

删除harbor

1
rm -rf /opt/harbor

删除相关的文件

1
2
3
4
5
6
7
8
9
10
rm -rvf $HOME/.kube
rm -rvf ~/.kube/
rm -rvf /etc/kubernetes/
rm -rvf /etc/systemd/system/kubelet.service.d
rm -rvf /etc/systemd/system/kubelet.service
rm -rvf /usr/bin/kube*
rm -rvf /etc/cni
rm -rvf /opt/cni
rm -rvf /var/lib/etcd
rm -rvf /var/etcd
This post is licensed under CC BY 4.0 by the author.