flannel CrashLoopBackOff原因
作者:互联网
系统日志
Feb 25 14:20:31 ubuntu systemd[1]: Started libcontainer container 15b23c11b8fee60349fd84e928d04d6fd26b9f04c0aadbc5aebde97d77765c8f.
Feb 25 14:20:31 ubuntu kernel: [166679.978936] IPVS: Creating netns size=2200 id=10507
Feb 25 14:20:31 ubuntu kubelet[32051]: W0225 14:20:31.532551 32051 docker_sandbox.go:394] failed to read pod IP from plugin/docker: networkPlugin cni failed on the status hook for pod "coredns-6955765f44-5mbc5_kube-system": CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container "e47f543f22801a9b5e7b24ff4bc040f4b88d01e8f640f5de1d29c9e4e1b9a527"
Feb 25 14:20:31 ubuntu kubelet[32051]: W0225 14:20:31.541562 32051 pod_container_deletor.go:75] Container "e47f543f22801a9b5e7b24ff4bc040f4b88d01e8f640f5de1d29c9e4e1b9a527" not found in pod's containers
Feb 25 14:20:31 ubuntu kubelet[32051]: W0225 14:20:31.543113 32051 cni.go:331] CNI failed to retrieve network namespace path: cannot find network namespace for the terminated container "e47f543f22801a9b5e7b24ff4bc040f4b88d01e8f640f5de1d29c9e4e1b9a527"
Feb 25 14:20:31 ubuntu kubelet[32051]: W0225 14:20:31.981118 32051 pod_container_deletor.go:75] Container "15b23c11b8fee60349fd84e928d04d6fd26b9f04c0aadbc5aebde97d77765c8f" not found in pod's containers
Feb 25 14:20:31 ubuntu kubelet[32051]: E0225 14:20:31.983964 32051 cni.go:364] Error adding kube-system_coredns-6955765f44-vk7lt/15b23c11b8fee60349fd84e928d04d6fd26b9f04c0aadbc5aebde97d77765c8f to network flannel/cbr0: open /run/flannel/subnet.env: no such file or directory
Feb 25 14:20:32 ubuntu kubelet[32051]: E0225 14:20:32.250576 32051 pod_workers.go:191] Error syncing pod 4a4c9415-eb46-4fb9-86cb-ad939dc4abf1 ("kube-flannel-ds-amd64-zxxn5_kube-system(4a4c9415-eb46-4fb9-86cb-ad939dc4abf1)"), skipping: failed to "StartContainer" for "kube-flannel" with CrashLoopBackOff: "back-off 5m0s restarting failed container=kube-flannel pod=kube-flannel-ds-amd64-zxxn5_kube-system(4a4c9415-eb46-4fb9-86cb-ad939dc4abf1)"
Feb 25 14:20:32 ubuntu containerd[1898]: time="2020-02-25T14:20:32.256414559+08:00" level=info msg="shim containerd-shim started" address="/containerd-shim/moby/c01e85bda34b4a7183f8933c2ebdae7d3ac2bfdb25861f41dcad42f5f8d2c7c0/shim.sock" debug=false pid=22523
root@ubuntu:~# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-6955765f44-5mbc5 0/1 ContainerCreating 0 5h8m
kube-system coredns-6955765f44-vk7lt 0/1 ContainerCreating 0 5h8m
kube-system etcd-ubuntu 1/1 Running 0 5h8m
kube-system kube-apiserver-ubuntu 1/1 Running 0 5h8m
kube-system kube-controller-manager-ubuntu 1/1 Running 6 5h8m
kube-system kube-flannel-ds-amd64-zxxn5 0/1 CrashLoopBackOff 60 4h50m
kube-system kube-proxy-ktnlr 1/1 Running 0 5h8m
kube-system kube-scheduler-ubuntu 1/1 Running 9 5h8m
root@ubuntu:~# kubectl logs kube-flannel-ds-amd64-zxxn5 -n kube-system
I0225 06:17:30.694624 1 main.go:514] Determining IP address of default interface
I0225 06:17:30.695221 1 main.go:527] Using interface with name enp0s31f6 and address 192.168.5.24
I0225 06:17:30.695258 1 main.go:544] Defaulting external address to interface address (192.168.5.24)
I0225 06:17:30.802692 1 kube.go:126] Waiting 10m0s for node controller to sync
I0225 06:17:30.802823 1 kube.go:309] Starting kube subnet manager
I0225 06:17:31.804762 1 kube.go:133] Node controller sync successful
I0225 06:17:31.804853 1 main.go:244] Created subnet manager: Kubernetes Subnet Manager - ubuntu
I0225 06:17:31.804867 1 main.go:247] Installing signal handlers
I0225 06:17:31.805019 1 main.go:386] Found network config - Backend type: vxlan
I0225 06:17:31.805131 1 vxlan.go:120] VXLAN config: VNI=1 Port=0 GBP=false DirectRouting=false
E0225 06:17:31.805533 1 main.go:289] Error registering network: failed to acquire lease: node "ubuntu" pod cidr not assigned
I0225 06:17:31.805614 1 main.go:366] Stopping shutdownHandler..
Normal SandboxChanged 7m38s (x4319 over 5h22m) kubelet, ubuntu Pod sandbox changed, it will be killed and re-created.
Warning FailedCreatePodSandBox 2m38s (x4381 over 5h22m) kubelet, ubuntu (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "e477bc3cf44820f2df210fb0da08c6be6412c7fa36d07ced77c7806203b7c87a" network for pod "coredns-6955765f44-5mbc5": networkPlugin cni failed to set up pod "coredns-6955765f44-5mbc5_kube-system" network: open /run/flannel/subnet.env: no such file or directory
3m53s Normal SandboxChanged pod/coredns-6955765f44-5mbc5 Pod sandbox changed, it will be killed and re-created.
8m51s Warning FailedCreatePodSandBox pod/coredns-6955765f44-5mbc5 (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "4c63e068defce69cb2c506c580b88ea8b220aba55e819c49ad34dbaa82945885" network for pod "coredns-6955765f44-5mbc5": networkPlugin cni failed to set up pod "coredns-6955765f44-5mbc5_kube-system" network: open /run/flannel/subnet.env: no such file or directory
28m Normal SandboxChanged pod/coredns-6955765f44-vk7lt Pod sandbox changed, it will be killed and re-created.
3m49s Warning FailedCreatePodSandBox pod/coredns-6955765f44-vk7lt (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "a4c24117ec668b952176f3be8db86303bf4c2dc08deeb8a44146fbee56853208" network for pod "coredns-6955765f44-vk7lt": networkPlugin cni failed to set up pod "coredns-6955765f44-vk7lt_kube-system" network: open /run/flannel/subnet.env: no such file or directory
是安装Kubeadm Init的时候,没有增加 --pod-network-cidr 10.244.0.0/16参数。
注意看日志
Error registering network: failed to acquire lease: node "ubuntu" pod cidr not assigned
标签:20,network,flannel,ubuntu,go,CrashLoopBackOff,pod,kube,原因 来源: https://blog.51cto.com/appop/2473461