k8s学习: ErrImagePull 和 ImagePullBackOff 怎么办?
非常感谢这篇文章解决了我的问题k8s.gcr.io 镜像国内拉不下来解决思路学习公开外部 IP 地址以访问集群中应用程序时,在这个最简单的“为一个在五个 pod 中运行的应用程序创建服务” 就遇到下载镜像失败,不是 ImagePullBackOff 就是 ErrImagePull按照以上文章第一种方法解决了我的问题记录一下docker search后替换原文中 image: gcr.io/goog
非常感谢这篇文章解决了我的问题
学习公开外部 IP 地址以访问集群中应用程序时,在这个最简单的“为一个在五个 pod 中运行的应用程序创建服务” 就遇到下载镜像失败,不是 ImagePullBackOff 就是 ErrImagePull
按照以上文章第一种方法解决了我的问题
记录一下
docker search后替换
-
原文中 image: gcr.io/google-samples/node-hello:1.0
-
尝试将 gcr.io 替换为 registry.aliyuncs.com ,或者registry.aliyuncs.com/google_containers 等,找不到!
-
docker search node-hello:1.0
NAME DESCRIPTION STARS OFFICIAL AUTOMATED empiregeneral/node-hello gcr.io/google_containers/node-hello:1.0 1 [OK] tomtsang/dockerlibraryk8s-node-hello gcr.io/google-samples/node-hello:1.0 0 [OK] yumingc/node-hello node-hello:1.0 0 [OK] gongcqq/node-hello gcr.io/google-samples/node-hello:1.0 0
可以看到其中 tomtsang/dockerlibraryk8s-node-hello 和 gongcqq/node-hello 都是缓存了 gcr.io/google-samples/node-hello:1.0
-
替换load-balancer-example.yaml 中iamge
image: tomtsang/dockerlibraryk8s-node-hello
然后
kubectl delete -f load-balancer-example.yamlkubectl apply -f load-balancer-example.yaml
耐心等待之后
kubectl get podsNAME READY STATUS RESTARTS AGE hello-world-76f58bd7bf-4fxr4 1/1 Running 0 5m38s hello-world-76f58bd7bf-7b4xd 1/1 Running 0 5m38s hello-world-76f58bd7bf-hxgrp 1/1 Running 0 5m38s hello-world-76f58bd7bf-sx44g 1/1 Running 0 5m38s hello-world-76f58bd7bf-t667v 1/1 Running 0 5m38s
虽然很慢,但是,总算 ok 了!
换成 pull 之后 tag 的方法
-
docker pull tomtsang/dockerlibraryk8s-node-hello
Using default tag: latest latest: Pulling from tomtsang/dockerlibraryk8s-node-hello ... Digest: sha256:1768734b2a86b4101fb49abe284e1f2b295e620cf7a051d6be850c4a44adf733 Status: Downloaded newer image for tomtsang/dockerlibraryk8s-node-hello:latest docker.io/tomtsang/dockerlibraryk8s-node-hello:latest
-
打 tag
docker tag tomtsang/dockerlibraryk8s-node-hello gcr.io/google-samples/node-hello:1.0 -
确认一下
docker images |grep node-hellotomtsang/dockerlibraryk8s-node-hello latest 1e2404f3042c 4 years ago 644MB gcr.io/google-samples/node-hello 1.0 1e2404f3042c 4 years ago 644MB
-
原文中恢复为 image: gcr.io/google-samples/node-hello:1.0
再来 apply 为什么会失败?那就先用前面替换的方法,后续再处理这个问题
containers: - image: gcr.io/google-samples/node-hello imagePullPolicy: IfNotPresent
加上 imagePullPolicy: IfNotPresent ,也不对!?
更多推荐
所有评论(0)