calico 文件丢失问题

1. 备份calico-node控制器YAML文件. 
    kubectl get daemonset calico-node -n kube-system -o yaml --export > calico-node.yaml
2. 删除calico-node pods.
    kubectl delete -f calico-node.yaml -n kube-system
3. 关闭所有节点calico tunnel接口.
    ansible k8s -m shell -a "ip link set tunl0 down" --become
4. 开启所有节点calico tunnel接口.
    ansible k8s -m shell -a "ip link set tunl0 up" --become
5. 确认所有节点没有tunl接口相关路由.
    ansible k8s -m shell -a "route -n" --become
6. 通过calitoctl delete node
    export ETCD_ENDPOINTS="http://172.16.95.35:2379,http://172.16.95.36:2379,http://172.16.95.37:2379,http://172.16.95.38:2379,http://172.16.95.39:2379"
    for i in $(calicoctl get node|grep node);do calicoctl delete node $i;done
    etcdctl --endpoints="http://172.16.95.35:2379,http://172.16.95.36:2379,http://172.16.95.37:2379,http://172.16.95.38:2379,http://172.16.95.39:2379" rm /calico --recursive
7. 重建calico-node
    kubectl apply -f calico-node.yaml
8. 验证calico连接状态
    calicoctl node status
etcdctl ls --recursive /calico|grep node3
etcdctl rm --recursive /calico/v1/host/xyqsdn-node3

  

原文地址:https://www.cnblogs.com/hanwei666/p/11685873.html