🤖

CNI network "cbr0": plugin type="flannel" failed (add): エラーが出る

2022/11/24に公開

エラー内容

ContainerCreatingのままで状態が進まず、Describeすると以下のようなエラーが出て、進まない。

Events:
  Type     Reason                  Age   From               Message
  ----     ------                  ----  ----               -------
  Normal   Scheduled               27s   default-scheduler  Successfully assigned rook-ceph/rook-ceph-operator-85748bbfc4-v2r86 to node1
  Warning  FailedCreatePodSandBox  26s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create pod network sandbox k8s_rook-ceph-operator-85748bbfc4-v2r86_rook-ceph_ad5b8002-6f85-46c2-896a-0ef7968fbacf_0(9eb6e31376fa26f246bb58b2a4620cf5c70c11524a632bf95d69dd4408712059): error adding pod rook-ceph_rook-ceph-operator-85748bbfc4-v2r86 to CNI network "cbr0": plugin type="flannel" failed (add): failed to delegate add: failed to set bridge addr: "cni0" already has an IP address different from 10.244.9.1/24
  Warning  FailedCreatePodSandBox  16s   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create pod network sandbox k8s_rook-ceph-operator-85748bbfc4-v2r86_rook-ceph_ad5b8002-6f85-46c2-896a-0ef7968fbacf_0(387647c271c96f29a174fd827d986f480cb177be7a8559fb356bb36bc4dfee9f): error adding pod rook-ceph_rook-ceph-operator-85748bbfc4-v2r86 to CNI network "cbr0": plugin type="flannel" failed (add): failed to delegate add: failed to set bridge addr: "cni0" already has an IP address different from 10.244.1.1/24
  Warning  FailedCreatePodSandBox  2s    kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to create pod network sandbox k8s_rook-ceph-operator-85748bbfc4-v2r86_rook-ceph_ad5b8002-6f85-46c2-896a-0ef7968fbacf_0(f341e6d1820c907ffecf92b271b01429b135a666b5b78c9b7bad5a5dcccbf811): error adding pod rook-ceph_rook-ceph-operator-85748bbfc4-v2r86 to CNI network "cbr0": plugin type="flannel" failed (add): failed to delegate add: failed to set bridge addr: "cni0" already has an IP address different from 10.244.1.1/24

原因

cni0が既に割り当てられているというメッセージだが、クラスタを組みなおした際のゴミ消しをし忘れているかもしれない。

この2つがcni関連のディレクトリで、kubeadm joinする前に、一度消してあげるとよい。
ちなみに、kubeadm resetすると、このあたりのディレクトリは消してね。というメッセージが出ていた。

rm -fr /var/lib/cni
rm -fr /etc/cni/net.d

Discussion