kubeadm init cannot find network namespace 错误
使用 kubeadm 安装好 weave 网络插件之后,查看 kubelet 输出信息发现如下错误:
4月 25 13:51:48 k8s-master kubelet[1232730]: I0425 13:51:48.124142 1232730 cni.go:334] "CNI failed to retrieve network namespace path" err="cannot find network namespace for the terminated container \"9f9ab4214a2ce280fd5791de0093ba3c12570b2614b4ec6132ed7ad679756679\""
4月 25 13:51:48 k8s-master kubelet[1232730]: weave-cni: Delete: no addresses for 9f9ab4214a2ce280fd5791de0093ba3c12570b2614b4ec6132ed7ad679756679
4月 25 13:51:49 k8s-master kubelet[1232730]: I0425 13:51:49.123453 1232730 cni.go:334] "CNI failed to retrieve network namespace path" err="cannot find network namespace for the terminated container \"a42d276da944504fbe246ced86d64388b373bc2578bf1d5ac2dcc1b9c5f4700e\""
4月 25 13:51:49 k8s-master kubelet[1232730]: weave-cni: Delete: no addresses for a42d276da944504fbe246ced86d64388b373bc2578bf1d5ac2dcc1b9c5f4700e
或者查看 coredns pod 带有如下地址的错误:
https://[xxx.xxx.0.1]:443/apis/crd.projectcalico.org/v1/clusterinformations/default
大概率是之前安装了 calico 网络插件或者其他CNI插件。
清理 /etc/cni/net.d 目录,重新安装 weave 插件。