[k8s]calico网络替换为flannel网络时,重建pod时异常。Failed to create pod sandbox
calico网络替换为flannel网络后,重建pod使用flannel组件分配ip。
[root@k8s-master01 net.d]# kubectl get pod -n kube-system NAME READY STATUS RESTARTS AGE coredns-6cc56c94bd-dzvfm 0/1 ContainerCreating 0 7m8s prometheus-8474f8559d-thmqn 0/2 Init:0/1 0 17h prometheus-adapter-7f94cc997d-qvttk 0/1 CrashLoopBackOff 217 35d Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 71s default-scheduler Successfully assigned kube-system/coredns-6cc56c94bd-dzvfm to k8s-node01 Warning FailedCreatePodSandBox 71s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "74326ae116c4502f1d9772dc0e19c6e7d8c13df4855e0354b631c10ccef3aedf" network for pod "coredns-6cc56c94bd-dzvfm": networkPlugin cni failed to set up pod "coredns-6cc56c94bd-dzvfm_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized, failed to clean up sandbox container "74326ae116c4502f1d9772dc0e19c6e7d8c13df4855e0354b631c10ccef3aedf" network for pod "coredns-6cc56c94bd-dzvfm": networkPlugin cni failed to teardown pod "coredns-6cc56c94bd-dzvfm_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized] Normal SandboxChanged 9s (x6 over 70s) kubelet Pod sandbox changed, it will be killed and re-created.
[root@k8s-master01 files]# cd /etc/cni/net.d/ [root@k8s-master01 net.d]# ll total 12 -rw-r--r-- 1 root root 613 Feb 16 11:41 10-calico.conflist -rw-r--r-- 1 root root 292 Feb 17 17:17 10-flannel.conflist -rw------- 1 root root 3066 Feb 16 11:41 calico-kubeconfig
删除calico相关的文件即可正常创建pod。每个节点都执行。
[root@k8s-node01 net.d]# ll total 4 -rw-r--r-- 1 root root 292 Feb 17 17:18 10-flannel.conflist
[root@k8s-master01 prometheus]# kubectl get pod -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-6cc56c94bd-92vrg 1/1 Running 0 43

浙公网安备 33010602011771号