如果集群初始化如果遇到问题,可以使用下面的命令进行清理
- 查看集群状态,确认组件都处于healthy状态
kubectl get cs
- master节点:
kubeadm reset
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
如何从集群移除从节点
- 在master节点上执行:
kubectl drain node2 --delete-local-data --force --ignore-daemonsets
kubectl delete node node2
- 在node2上执行:
kubeadm reset
ifconfig cni0 down
ip link delete cni0
ifconfig flannel.1 down
ip link delete flannel.1
rm -rf /var/lib/cni/
- 在master上执行:
kubectl delete node node2