Can't create Cron jobs

Hello guys.

I’m trying to create a Cron Job on Rancher UI, but no matter what I put on the field for the cron specification (for example “0 * * * *”,"@hourly" or anything), I always receive this error when pressing the “Launch” button:

“Validation failed in API: CronJob.batch “rapi-scheduler” is invalid: spec.jobTemplate.spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{“controller-uid”:“159b276c-801f-11e9-b31c-0a1076b70042”}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: selector will be auto-generated”

Honestly, I don’t understand what is it.

If I create a normal job (not croned), it works without any issue, so neither the container nor the command are the problem.

Can someone help me?

Hi, i am having the same problem. Tried to solve it, but no luck yet.
I can create normal jobs, everything works, but can not create CronJobs.

Rancher version 2.2.4.

Do not know what “spec.jobTemplate.spec.selector” means. Could not find anything that could help.
Is someone having sorted this or similar provlem?

are there any other fields you are setting? like, further down in the UI?

Had the same issue.
Turns out that this only happens when I try to clone from an existing workload which is configured as “Scalable Deployment” and then changing it to “Cronjob”.
Looks pretty much like a bug, anyways creating a fresh workload instead of cloning an existing one solved it for me.

1 Like

I have the same issue, is there any solution?

Hey don’t know if this is still an issue but I just had to create a cronjob in rancher 2.4.x and this is now an UI version. Also you can write the yaml file with a:

apiVersion: batch/v1beta1
kind: CronJob

One thing to note, it does appear that you can’t use / or other cronjob abbreviations. So I had to explicitly say run at 0,30.