<p>I am pulling an image from a private repository on gitlab and running a cronjob in kubernetes. Since it is a private repo I would also have to supply the imagePullSecrets. but I noticed it gives an error because a cronjob doesn't accept the imagePullSecrets tag. It gives the following error. Does that mean I can't use an image from a private repository in a cronjob?</p>

<pre><code>error: error validating "cron.yml": error validating data: ValidationError(CronJob.spec.jobTemplate.spec.template.spec.containers[0]): unknown field "imagePullSecrets" in io.k8s.api.core.v1.Container; if you choose to ignore these errors, turn validation off with --validate=false
</code></pre>

<p>The <code>imagePullSecrets</code> field is not a per container field - you need to set that at <code>CronJob.spec.jobTemplate.spec.template.spec.imagePullSecrets</code> instead of <code>CronJob.spec.jobTemplate.spec.template.spec.containers.imagePullSecrets</code>. You can see an example for a Pod <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry#create-a-pod-that-uses-your-secret" rel="noreferrer">here</a>.</p>
