Skip to main content

Triggering a CronJob

Run this command to trigger a CronJob resource in Kubernetes:

kubectl create job --from=cronjob/CRONJOB JOB_NAME -n NAMESPACE

This command works because it will use the job template (spec.jobTemplate) from an existing CRONJOB. You will need to supply JOB_NAME, which must be unique considering all other Jobs in the same NAMESPACE.

You can use this to test if a CronJob works without changing its execution (i.e. cron) schedule.