Pcornel
Automation · Kubernetes Automation

CronJobs

Cheat sheet · https://pcornel.dk/topic.php?topic=5800

Back to the Topic

Answer

CronJobs run Kubernetes Jobs on a cron schedule, such as nightly backups or reports, with settings for concurrency, history limits and starting deadlines.

Remember

  • CronJobs create Jobs on a cron schedule.
  • concurrencyPolicy controls overlaps.
  • History limits keep old Jobs manageable.

First checks

  • kubectl get cronjobs -n <ns> — cronjobs
  • kubectl create job --from=cronjob/<n> test-run — manual test run
  • concurrencyPolicy and startingDeadlineSeconds — behaviour

Commands

kubectl create job --from=cronjob/config-backup test-run

Verify in this order

schedule → Job → pods

Where it usually breaks

Trigger → queue accepted → worker lease/pickup → task running → terminal result → target mutation/read-back → effective runtime state → workload.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5800

Confirmation

Confirm action

Continue?