集群内安装了
- flanal-用于Pod网络
- canal-用于网络ACL
在初期进行集群的初始化和配置时,在删除了canal后尝试重启了CoreDNS,但是发现无论如何重启,CoreDNS永远处于ContainerCreating
的状态
describe一下ContainerCreating
的Pod
kubectl describe pods -n kube-system coredns-<***>
着重查看Events部分
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 28s default-scheduler Successfully assigned kube-system/coredns-7dfb448f-kl8n4 to cn-02101-prod-as-k8s-tl-w-03
Warning FailedCreatePodSandBox 27s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "2e2dc0d544b37f326720bee9f5a2b12f6d4fa76e7f6f770c18f55d7ed92c2999" network for pod "coredns-7dfb448f-kl8n4": networkPlugin cni failed to set up pod "coredns-7dfb448f-kl8n4_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized, failed to clean up sandbox container "2e2dc0d544b37f326720bee9f5a2b12f6d4fa76e7f6f770c18f55d7ed92c2999" network for pod "coredns-7dfb448f-kl8n4": networkPlugin cni failed to teardown pod "coredns-7dfb448f-kl8n4_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized]
Normal SandboxChanged 1s (x4 over 26s) kubelet Pod sandbox changed, it will be killed and re-created.
networkPlugin cni failed to set up pod "coredns-7dfb448f-kl8n4_kube-system"
发现cni的网络插件无法创建SandBox
这是由于kubectl删除了canal或calico配置,但是目标机器上依然保留着其cni配置导致的
在无法启动的node上删除掉/etc/cni/net.d
/ 目录下的 calico 和 canal 配置文件重启目标机器即可。
注意:最好所有的非master节点都这样操作一下
[root@node2 ~]# ll /etc/cni/net.d/
total 12
-rw-r--r-- 1 root root 712 Oct 8 01:16 10-canal.conflist
-rw-r--r-- 1 root root 292 Oct 8 01:06 10-flannel.conflist
-rw------- 1 root root 2697 Oct 8 01:16 calico-kubeconfig
[root@node2 ~]# rm -rf /etc/cni/net.d/calico-kubeconfig
[root@node2 ~]# rm -rf /etc/cni/net.d/10-canal.conflist
然后就好了
顺便重新安装了canal~
冶心·练体·得技