Kubernetes
Kubernetes CronJob generator
Pick a schedule, preview next runs, and copy CronJob YAML snippets ready for kubectl apply.
Live expression
Kubernetes CronJob
0Minute
9Hour
*Day
*Month
1-5Weekday
- Info: This only runs on weekdays (Monday-Friday)
Try a preset
Snippets
Kubernetes CronJob
Deploy this CronJob to your Kubernetes cluster
apiVersion: batch/v1
kind: CronJob
metadata:
name: my-scheduled-job
spec:
schedule: "0 9 * * 1-5"
jobTemplate:
spec:
template:
spec:
containers:
- name: my-scheduled-job
image: your-image:latest
command:
- /bin/sh
- -c
- /path/to/your/script.sh
restartPolicy: OnFailureyamlKubernetes CronJob schedule format
CronJobs use a standard 5-field schedule string (same shape as Linux crontab) in spec.schedule. Timezone defaults to the kube-controller-manager zone unless you set .spec.timeZone.
- Fields: minute hour day-of-month month day-of-week
- Put the expression in quotes under spec.schedule
- Set restartPolicy on the pod template (OnFailure or Never)
- Use concurrencyPolicy to control overlapping runs
- Prefer descriptive metadata.name and resource limits
- Kubernetes 1.27+ supports spec.timeZone for IANA zones
CronJob YAML skeleton
apiVersion: batch/v1
kind: CronJob
metadata:
name: weekday-job
spec:
schedule: "0 9 * * 1-5"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
containers:
- name: job
image: busybox:1.36
command: ["/bin/sh", "-c", "echo hello"]
restartPolicy: OnFailureFAQ
Standard 5-field cron: minute hour day-of-month month day-of-week. It does not use Quartz seconds or AWS cron() wrapping.