apt install ansible pdsh
cp hosts.template hosts
cp pdsh_hosts.template pdsh_hosts
ssh-agent bash
ssh-add ~/.ssh/id_rsa
ansible-playbook -i ./hosts ./init.yml
ansible-playbook -i ./hosts ./deps.yml
ansible-playbook -i ./hosts ./master.yml
ssh k8s@master_ip
kubectl get nodes
ansible-playbook -i ./hosts ./nodes.yml
ssh k8s@master_ip
kubectl get nodes
pdsh -w ^pdsh_hosts -R ssh "kubeadm reset -f"
pdsh -w ^pdsh_hosts -R ssh "rm -rf /etc/cni/net.d"
pdsh -w ^pdsh_hosts -R ssh "ip link delete flannel.1; ip link delete cni0"
pdsh -w ^pdsh_hosts -R ssh "ip link delete cni0"
pdsh -w ^pdsh_hosts -R ssh "rm -rf /home/k8s/.kube"
pdsh -w ^pdsh_hosts -R ssh "rm -rf /root/*.log; rm -rf /home/k8s/*.log"
# wipe docker
pdsh -w ^pdsh_hosts -R ssh "apt-get purge docker-ce docker-ce-cli containerd.io; apt autoremove"
pdsh -w ^pdsh_hosts -R ssh "rm -rf /var/lib/docker"
# wipe k8s
pdsh -w ^pdsh_hosts -R ssh "apt-get apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*; apt autoremove"
pdsh -w ^pdsh_hosts -R ssh "rm -rf /etc/cni /etc/kubernetes /var/lib/dockershim /var/lib/etcd /var/lib/kubelet /var/run/kubernetes ~/.kube/*"
pdsh -w ^pdsh_hosts -R ssh "iptables -F && iptables -X; \
iptables -t nat -F && iptables -t nat -X; \
iptables -t raw -F && iptables -t raw -X; \
iptables -t mangle -F && iptables -t mangle -X"
pdsh -w ^pdsh_hosts -R ssh "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys [key from apt update error]"
alias k=kubectl
complete -F __start_kubectl k