-1

When I was trying to create a deployment in microk8s, I got some problem with docker images.

My yaml looks like this,as you can see,I use the IfNotPresent ImagePullPolicy to create my deployment:

enter image description here

I pull the image to my docker:

enter image description here

However, it seems k8s cannot find the images inside my computer:

enter image description here enter image description here

Anyone can help me to solve the problem?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
朱江源
  • 1
  • 1
  • 1
    so, in case of minikube, the docker engine that it uses is separate from the host docker engine. And in that case you will have to load the image into the minikube's docker engine. Can you if same is the case with microk8s. – viveksinghggits Feb 09 '20 at 08:30
  • please copy-paste the relevant text into the question instead of putting external iamges. – morgwai Feb 09 '20 at 09:20
  • please provide the output of `kubectl describe pod your-pod-name` – morgwai Feb 09 '20 at 09:27
  • @viveksinghggits It seems like microK8s did not use the host docker engine. I don't know it works, I sloved the problem by push the iamges into my dockerhub and update the address of the pod images. Thanks a lot for your help. – 朱江源 Feb 10 '20 at 09:10
  • @morgwai The last pic shows the output of kubectl describe pod your-pod-name. It seems like microk8s could not find the image of host docker. Because I am in china, there is a firewall, so it can't download the images from the url. I sloved the problem by push the iamges into my dockerhub and update the address of the pod images. Thanks for your help. And thank your advices, I will upload the relevant text nexttime. – 朱江源 Feb 10 '20 at 09:14
  • Can you post your solution as an answer? This way it will be visible for the rest of community and others can benefit from it. – kool Feb 10 '20 at 11:44
  • @ KFC_ Thanks for your advice. Here is my solution. Use "docker tag k8s.gcr.io/heapster-grafana-amd64:v1.3.3 {your dockerhub account}/heapster-grafana-amd64:v1.3.3" to rename your image. Then use "docker push {your dockerhub account}/heapster-grafana-amd64:v1.3.3" to push the image into you dockerhub. At the same time, you need to change the image location of your pod to "{your dockerhub account}/heapster-grafana-amd64:v1.3.3". In this way, you can use "docker create -f xxx,yaml" to create your pod. – 朱江源 Feb 11 '20 at 02:18

1 Answers1

0

Posting @朱江源 solution as community wiki.

Use "docker tag k8s.gcr.io/heapster-grafana-amd64:v1.3.3 {your dockerhub account}/heapster-grafana-amd64:v1.3.3" to rename your image.

Then use "docker push {your dockerhub account}/heapster-grafana-amd64:v1.3.3" to push the image into you dockerhub. At the same time, you need to change the image location of your pod to "{your dockerhub account}/heapster-grafana-amd64:v1.3.3". In this way, you can use "docker create -f xxx,yaml" to create your pod.

Additionally there are container registry proxies for users from China:

global                 proxy in China       format

dockerhub (docker.io)  dockerhub.azk8s.cn   dockerhub.azk8s.cn/<repo-name>/<image-name>:<version>
gcr.io                 gcr.azk8s.cn         gcr.azk8s.cn/<repo-name>/<image-name>:<version>
quay.io                quay.azk8s.cn        quay.azk8s.cn/<repo-name>/<image-name>:<version>
mcr.microsoft.com      mcr.azk8s.cn         mcr.azk8s.cn/<repo-name>/<image-name>:<version>
Community
  • 1
  • 1
kool
  • 3,214
  • 1
  • 10
  • 26