#!/bin/bash

#auto_install_pid=`ps -aux | grep auto_install | grep -v grep | awk -F " " '{print $2}'`
#kill -9 $auto_install_pid
echo "destroy k8s allinone default start"
docker exec -it kubeasz ezctl destroy default
sleep 1
#kubeasz_pid=`docker ps | grep kubeasz | awk -F " " '{print $1}'`
echo "#########################################################"
#echo "kubeasz_pid="$kubeasz_pid
#docker stop "$kubeasz_pid"
#docker rm "$kubeasz_pid"
cd /opt/keInstallK8S/soft && ./ezdown -C
docker system prune -a
systemctl stop docker
rm -rf /etc/kubeasz
rm -rf /etc/kube
rm -rf /usr/bin/containerd
rm -rf /usr/bin/containerd-shim
rm -rf /usr/bin/containerd-shim-runc-v2
rm -rf /usr/bin/ctr
rm -rf /usr/bin/docker
rm -rf /usr/bin/dockerd
rm -rf /usr/bin/docker-init
rm -rf /usr/bin/docker-proxy
rm -rf /usr/bin/runc
rm -rf /usr/local/bin/docker-compose
echo "destroy k8s allinone default finished"
