Pod container error init:ImagePullBackOff solution in kubernetes

Environmental description:

When kubeadm installs a single master cluster and installs the flannel network plug-in, the errors encountered are as follows:

The image of node1 has been downloaded and is in the Running state, but the master reports an error init:ImagePullBackOff

[root@k8smaster ~]# kubectl get pods -n kube-system
NAME                          READY    STATUS                  RESTARTS   AGE
kube-flannel-ds-jfkv6          1/1     Running                 0          12m
kube-flannel-ds-s6wnb          0/1  Init:ImagePullBackOff      0          12m


The reason is: failed to pull the image


Troubleshooting steps:

Method 1: The master directly pulls the image, the version number can be found in the kube-flannel.yml file;

[root@k8smaster ~]# docker pull quay.io/coreos/flannel:v0.13.1-rc2


Method 2: On node1, save the image and copy it to the master

[root@k8snode1 ~]# docker save -o flannel.tar.gz quay.io/coreos/flannel:v0.13.1-rc2
[root@k8snode1 ~]# ls -lh
-rw-------  1 root root  63M 2月   7 17:06 flannel.tar.gz
[root@k8snode1 ~]# scp ./flannel.tar.gz 172.16.80.20:/root/


Load mirror on master

  [root@k8smaster ~]# docker load -i flannel.tar.gz

QQ20210207-171827.png

After successfully loading the image, check that the pods become Running again, and the nodes are also Ready.

QQ20210207-172018.png


Guess you like

Origin blog.51cto.com/mofansheng/2643732