Free Kubernetes CronJob YAML generator. Build a complete batch/v1 CronJob manifest with schedule, concurrencyPolicy, history limits, and container spec — ready to apply with kubectl apply -f. Standard 5-field cron syntax, timezone set by the cluster's node timezone.
0 2 * * *apiVersion: batch/v1
kind: CronJob
metadata:
name: my-cronjob
namespace: default
spec:
schedule: "0 2 * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: my-cronjob
image: busybox:1.35
command:
- /bin/sh
- -c
- echo "Running scheduled task"# values.yaml for a Helm chart cronJob: name: my-cronjob schedule: "0 2 * * *" image: busybox:1.35 command: "echo "Running scheduled task"" concurrencyPolicy: Forbid
ForbidIf the previous job is still running when the next one is due, skip the new one. Use for jobs that must not overlap (DB migrations, backups).
AllowMultiple instances can run simultaneously. Fine for idempotent jobs with no state conflicts. Default in older Kubernetes versions.
ReplaceKill the currently running job and start a new one. Use when fresh data is more important than completing the previous run.
Apply the generated YAML with: kubectl apply -f cronjob.yaml. Verify with: kubectl get cronjobs. View logs with: kubectl logs job/my-cronjob-<timestamp>.
By default, Kubernetes CronJobs use the timezone of the kube-controller-manager node. Kubernetes 1.27+ added a timeZone field in the CronJob spec. For older clusters, convert your times to the node timezone.
Run: kubectl patch cronjob my-cronjob -p '{"spec":{"suspend":true}}'. Resume with false. This stops new jobs from being created but doesn't affect currently running jobs.
This controls how many completed Job objects Kubernetes keeps. Default is 3. Set to 0 to delete completed jobs immediately. Keeping some is useful for debugging with kubectl logs.
kubectl create job --from=cronjob/my-cronjob manual-run-1. This creates a one-off Job from the CronJob template immediately.
kubectl apply -f cronjob.yamlApply the CronJobkubectl get cronjobsList all CronJobskubectl get jobsList triggered Jobskubectl describe cronjob <name>View CronJob detailskubectl logs job/<name>-<ts>View job logskubectl delete cronjob <name>Delete CronJob