CronJob pod status is ImagePullBackOff

2/21/2019

I do a build off my console application and apply a cronjob successfully. But when I look up the pods I get the status ImagePullBackOff (after ErrImagePull). What could cause this missing Image Error? Frank

-- Frank Mehlhop
kubernetes
kubernetes-cronjob

2 Answers

2/26/2019

In this case, the issue is that Kubernetes is not able to find this tagged image. This happens because it does not exist on the Node on which you want to create the pod using that image. You have two choices. First is to build and tag that image on all of the Nodes (if you have one it is not a problem, but still just a workaround). Alternatively, you can create a private repository and use the images from there. The second process has been described in here.

You can test if that is the problem by building the same image on the worker Node, tagging it properly and then using:

kubectl run Pod_Name --image=image_name --replicas=1 --image-pull-policy=Never

Check the status of the Pods and if it's running that is the reason of the error.

I have tested it and this solution works, but it is kind of unnecessary work to build every new image on a target Node so I would recommend using private registry.

-- aurelius
Source: StackOverflow

2/26/2019

Adding to the cronjob this lines helps in my case..

        {{- if .Values.image.pullSecrets }}
      imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 12 }}
    {{- end }}
-- Frank Mehlhop
Source: StackOverflow