2

I am creating a pod from an image which resides on the master node. When I create a pod on the master node to be scheduled on the worker node, I get the status of pod ErrImageNeverPull

kind: Pod
metadata:
   name: cloud-pipe
   labels:
      app: cloud-pipe
spec:
   containers:
     - name: cloud-pipe
       image: cloud-pipeline:latest
       command: ["sleep"]
       args: ["infinity"]

Kubectl describe pod details:

   Type     Reason             Age                   From               Message
   - ---     ------             ----                  ----               -------   
    Normal   Scheduled          15m                   default-scheduler  Successfully assigned 
    default/cloud-pipe to knode
    Warning  ErrImageNeverPull  5m54s (x49 over 16m)  kubelet            Container image "cloud- 
    pipeline:latest" is not present with pull policy of Never
    Warning  Failed             51s (x72 over 16m)    kubelet            Error: ErrImageNeverPull

How to resolve this issue. Also, my question is does Kubernetes by default looks on the worker node for the image to exist?. Thanks

Mazia
  • 63
  • 1
  • 10
  • Do you have `imagePullPolicy: never` specified in your pod manifest? If so, that's why it's not trying to pull the image. Also the way you're specifying your image there, for most k8s clsuters would cause it to look on Docker hub for that image and AFAIK it's not there. If you want it to pull from a different container registry you need to pull the hostname and port of the registry in there. – Rory McCune Nov 07 '20 at 16:29

1 Answers1

4

When kubernetes creates containers, it first looks to local images, and then will try registry(docker registry by default)

You are getting this error because:

  • your image cant be found localy on your node.

  • you specified imagePullPolicy: Never, so you will never try to download image from registry

You have few ways of resolving this, but all of them generally instruct you to get image locally and tag it properly.

To get image on your node you can:

Once you get image, tag it and specify in the deployment

docker tag cloud-pipeline:latest mytest:mytest

kind: Pod
metadata:
   name: cloud-pipe
   labels:
      app: cloud-pipe
spec:
   containers:
     - name: cloud-pipe
       image: mytest:mytest
       imagePullPolicy: Never
       command: ["sleep"]
       args: ["infinity"]

Or you can configure own local registry, push tagged image into it, and use imagePullPolicy: IfNotPresent. More information in @dryairship answer

Also please be sure using eval $(minikube docker-env) for imagePullPolicy: Never images, in case you are using minikube (you havent specified any tag, but it can be helpful). More information in Getting “ErrImageNeverPull” in pods question

Vit
  • 7,740
  • 15
  • 40