Kubernetes failed to setup network for pod after executed kubeadm reset

后端 未结 6 1097
故里飘歌
故里飘歌 2021-02-03 12:41

I initialized Kubernetes with kubeadm init, and after I used kubeadm reset to reset it I found --pod-network-cidr was wrong. After correct

相关标签:
6条回答
  • 2021-02-03 13:10

    I had an issue after change of --pod-network-cidr, with join reporting success but no node being added. kubeadm reset and re-join had no effect. Solved through apt-get remove kubelet kubeadm kubectl kubernetes-cni after reset, followed by docker and/or machine restart, followed by reinstall and then join agin.

    0 讨论(0)
  • 2021-02-03 13:13

    This document helped a lot:

    https://github.com/feiskyer/kubernetes-handbook/blob/master/en/troubleshooting/pod.md

    specially the part which applies to this issue:

    $ ip link set cni0 down
    $ brctl delbr cni0  
    

    If you do this on the api servers and then just reboot the machine it should stabilize pretty quickly.

    0 讨论(0)
  • 2021-02-03 13:14

    I figured it out, if you change --pod-network-cidr when you reinitialize kubernetes via kubeadm init, you should delete some auto-created things, just follow the steps below before you execute kubeadm init again:

    1. execute kubeadm reset on master and nodes.

    2. execute etcdctl rm --recursive registry reset data in etcd.

    3. rm -rf /var/lib/cni on master and nodes

    4. rm -rf /run/flannel on master and nodes

    5. rm -rf /etc/cni on master and nodes

    6. ifconfig cni0 down on master and nodes

    7. brctl delbr cni0 on master and nodes

    Now, my Kubernetes works fine :)

    0 讨论(0)
  • 2021-02-03 13:17

    What helped for me:

    • ip link set cni0 down

      brctl delbr cni0

      Delete and re-apply flannel

    So no need to build up your cluster again

    0 讨论(0)
  • 2021-02-03 13:24

    I had a similar issue and the fix in that case was to apply the flannel pod network to the cluster:

    wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
    kubectl apply -f kube-flannel.yml
    
    0 讨论(0)
  • 2021-02-03 13:25

    After kubeadm reset and before kubeadm init do the following on master and worker nodes:

    1. kubeadm reset
    2. systemctl stop kubelet & systemctl stop docker
    3. rm -rf /var/lib/cni/
    4. rm -rf /var/lib/kubelet/*
    5. rm -rf /etc/cni/
    6. ifconfig cni0 down & ip link delete cni0
    7. ifconfig flannel.1 down & ip link delete flannel.1
    8. ifconfig docker0 down

    Tested with kubernetes server version: v1.13.2 & flannel: v0.10.0-amd64

    github issue reference

    0 讨论(0)
提交回复
热议问题