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?
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
The imagePullSecrets field is not a per container field - you need to set that at CronJob.spec.jobTemplate.spec.template.spec.imagePullSecrets instead of CronJob.spec.jobTemplate.spec.template.spec.containers.imagePullSecrets. You can see an example for a Pod here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With