6/845 min
Primitives
CronJobs β Scheduled Work
Run Jobs on a time schedule using standard cron syntax. Essential for backups, cleanups, and reports.
beginner45 minRead β Lab β Quiz β Practice
π§ Brain Warm-Up
π§ Brain Warm-Up: If your backup CronJob runs every hour but takes 90 minutes to complete, what happens at the next scheduled run? Should the old job be killed? Allowed to run in parallel? Think about concurrencyPolicy before reading.
CronJob β Job β Pod
CronJobs create Jobs on a schedule. Jobs run Pods to completion.
CronJob (schedule: "0 * * * *")
βββ Job nginx-backup-1730000000 (created each hour)
βββ Pod nginx-backup-1730000000-abc12 (runs task, exits 0)Cron Schedule Syntax
ββββ minute (0-59) β ββββ hour (0-23) β β ββββ day of month (1-31) β β β ββββ month (1-12) β β β β ββββ day of week (0-6, Sun=0) β β β β β * * * * * Examples: "0 * * * *" every hour at :00 "*/5 * * * *" every 5 minutes "0 2 * * *" every day at 02:00 "0 0 * * 0" every Sunday at midnight
Key Fields
| Field | Default | Meaning |
|---|---|---|
concurrencyPolicy | Allow | Allow/Forbid/Replace concurrent runs |
successfulJobsHistoryLimit | 3 | Keep N completed jobs |
failedJobsHistoryLimit | 1 | Keep N failed jobs |
startingDeadlineSeconds | nil | Miss window β skip |
suspend | false | Pause scheduling |
concurrencyPolicy
- Allow: new job starts even if previous still running
- Forbid: skip new run if previous still running
- Replace: kill previous run, start new one