Cron Expressions for Kubernetes CronJob
Kubernetes CronJob uses standard 5-field cron syntax to schedule batch jobs. Since Kubernetes 1.27, you can specify a timezone with spec.timeZone. CronJobs create Job objects that run to completion.
Common Kubernetes Cron Patterns
*/5 * * * *Runs a job every 5 minutes
0 * * * *Runs at the top of every hour
0 2 * * *Runs at 02:00 every night
0 0 * * 0Runs every Sunday at midnight
0 9 1 * *Runs at 09:00 on the 1st of every month
0 */6 * * *Runs four times per day
30 7 * * 1-5Runs at 07:30 Monday through Friday
0 0 1 1,4,7,10 *Runs at midnight on January 1, April 1, July 1, October 1
Kubernetes CronJob Manifest
apiVersion: batch/v1
kind: CronJob
metadata:
name: database-backup
namespace: production
spec:
# Run every day at 02:00
schedule: "0 2 * * *"
# Optional: specify timezone (requires k8s 1.27+)
timeZone: "America/New_York"
# Prevent overlapping runs
concurrencyPolicy: Forbid
# Allow up to 30s late start before skipping
startingDeadlineSeconds: 30
# Keep last 3 successful and 1 failed job
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: backup
image: your-backup-image:latest
command: ["/bin/sh", "-c", "pg_dump $DB_URL > backup.sql"]How Kubernetes Differs from Standard Crontab
Kubernetes CronJob uses standard 5-field cron syntax identical to crontab. The key addition is spec.timeZone (k8s 1.27+) for explicit timezone control, and CronJob-specific fields like concurrencyPolicy and startingDeadlineSeconds.
Common Gotchas & Pitfalls
Timezone defaults to the cluster's system timezone — use spec.timeZone (k8s 1.27+) for explicit control.
Set concurrencyPolicy: Forbid if your job must not overlap; Allow is the default.
startingDeadlineSeconds defines how late a missed job can start — set it to prevent pile-ups after downtime.
CronJob controller checks every 10 seconds, so minimum meaningful interval is around 1 minute.
If more than 100 schedules are missed (e.g., cluster was down), Kubernetes will not backfill them.
Job pods remain after completion — use successfulJobsHistoryLimit and failedJobsHistoryLimit to control cleanup.
Daylight saving time transitions can cause jobs to be skipped or doubled if timezone is set.
Other Platform Guides
More Cron Expression Tools
Translate, build, test, and reference cron expressions — all in one place.