12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/bin/sh
- systemctl disable --now kubelet
- systemctl disable --now kube-proxy
- systemctl disable --now kube-scheduler
- systemctl disable --now kube-controller-manager
- systemctl disable --now kube-apiserver
- systemctl disable --now etcd
- rm -rf /etc/etcd /etc/kubernetes
- rm -rf /etc/cni/net.d
- rm -rf /var/lib/cni/
- rm -rf /var/lib/etcd
- crictl ps -q | xargs crictl stop
- crictl ps -a -q | xargs crictl rm
- mount -l | grep '/var/lib/kubelet' | awk '{print $3}' | xargs umount
- rm -rf /var/lib/kubelet
- systemctl stop containerd
- rm -rf /var/lib/containerd
- systemctl start containerd
- export_addr=$(curl ipv4.icanhazip.com)
- sed "/$export_addr .*/d" /etc/hosts -i
- markS="##### ca-etcd-k8s envionment #####"
- markE="##################################"
- remove_env_profile() {
- sed "/$markS/d" /etc/profile -i
- sed "/export expiry=.*/d" /etc/profile -i
- sed "/export ca_config_path=.*/d" /etc/profile -i
- sed "/export etcd_pki_path=.*/d" /etc/profile -i
- sed "/export etcd_ips_list=.*/d" /etc/profile -i
- sed "/export k8s_pki_path=.*/d" /etc/profile -i
- sed "/export k8s_ips_list=.*/d" /etc/profile -i
- sed "/export export_addr=.*/d" /etc/profile -i
- sed "/export export_port=.*/d" /etc/profile -i
- sed "/$markE/d" /etc/profile -i
- }
- remove_env_profile
|