【K8S】ImagePullBackOff

1.创建POD时提示镜像拉取失败

[root@K8S1 work]# kubectl get pod -A
NAMESPACE     NAME                                       READY   STATUS             RESTARTS   AGE
kube-system   calico-kube-controllers-554647c955-rb5fs   1/1     Running            0          11h
kube-system   calico-node-4r2wv                          1/1     Running            0          11h
kube-system   calico-node-mpc7n                          1/1     Running            0          11h
kube-system   calico-node-mqckp                          1/1     Running            0          11h
kube-system   calico-node-qc27n                          1/1     Running            0          11h
kube-system   calico-node-rz2w9                          1/1     Running            0          11h
kube-system   calico-node-skgwx                          1/1     Running            0          11h
kube-system   calico-typha-6454f6cfd7-shs92              1/1     Running            0          11h
kube-system   coredns-685689ff44-clwqt                   0/1     ImagePullBackOff   0          2m16s
kube-system   coredns-685689ff44-db9n8                   0/1     ImagePullBackOff   0          2m16s
kube-system   coredns-685689ff44-fm9lv                   0/1     ImagePullBackOff   0          2m16s

2.原因分析 

镜像版本标记错误。

vi coredns.yaml 

[root@K8S1 work]# docker images
REPOSITORY                                     TAG       IMAGE ID       CREATED       SIZE
192.168.1.11:443/myharbor/typha                v3.22.0   35c2fa1ee0a1   2 years ago   127MB
192.168.1.11:443/myharbor/kube-controllers     v3.22.0   df76d42861ee   2 years ago   132MB
192.168.1.11:443/myharbor/cni                  v3.22.0   f86797de8afd   2 years ago   236MB
192.168.1.11:443/myharbor/pod2daemon-flexvol   v3.22.0   59daef946c8c   2 years ago   21.4MB
192.168.1.11:443/myharbor/node                 v3.22.0   f109b1742d34   2 years ago   213MB
192.168.1.11:443/myharbor/coredns              1.8.6     a4ca41631cc7   2 years ago   46.8MB
192.168.1.11:443/myharbor/pause                3.6       6270bb605e12   2 years ago   683kB

coredns的版本应该改成:1.8.6,而之前却是:1.11.1,显然没有这个版本。

3.重新配置coredns 

[root@K8S1 work]# kubectl delete -f coredns.yaml 
serviceaccount "coredns" deleted
clusterrole.rbac.authorization.k8s.io "system:coredns" deleted
clusterrolebinding.rbac.authorization.k8s.io "system:coredns" deleted
configmap "coredns" deleted
deployment.apps "coredns" deleted
service "kube-dns" deleted
[root@K8S1 work]# kubectl create -f coredns.yaml 
serviceaccount/coredns created
clusterrole.rbac.authorization.k8s.io/system:coredns created
clusterrolebinding.rbac.authorization.k8s.io/system:coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
[root@K8S1 work]# kubectl get pod -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-554647c955-rb5fs   1/1     Running   0          11h
kube-system   calico-node-4r2wv                          1/1     Running   0          11h
kube-system   calico-node-mpc7n                          1/1     Running   0          11h
kube-system   calico-node-mqckp                          1/1     Running   0          11h
kube-system   calico-node-qc27n                          1/1     Running   0          11h
kube-system   calico-node-rz2w9                          1/1     Running   0          11h
kube-system   calico-node-skgwx                          1/1     Running   0          11h
kube-system   calico-typha-6454f6cfd7-shs92              1/1     Running   0          11h
kube-system   coredns-686b957769-ssqnk                   1/1     Running   0          6s
kube-system   coredns-686b957769-xgdv8                   1/1     Running   0          6s
kube-system   coredns-686b957769-zcppf                   1/1     Running   0          6s

果然全部拉取成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值