Zero Signup ToolsFree browser tools

Developer Tools

Kubernetes CronJob Generator

Generate a complete Kubernetes CronJob YAML from a cron schedule, image, and command. Sets concurrency, timezone, history limits, retries, and resources.

CronJob

Schedule and identity

DNS-1123 label, 52 characters max. Used for metadata.name and the app.kubernetes.io/name label.

Leave blank to apply into the current namespace.

Five fields: minute hour day-of-month month day-of-week. Vixie nicknames such as @daily and @hourly are also accepted.

spec.timeZone needs Kubernetes 1.27 or newer (stable). On older clusters, leave this blank; the schedule then follows the controller-manager time zone.

Behavior

Concurrency, history, and retries

Concurrency policy
Pod restart policy

Container

Image and command

Use an explicit tag or a digest, not latest.

Split into argv. Quote tokens that contain spaces, like 'echo hello world'.

Passed after command. With /bin/sh -c, put the whole script in a single quoted arg.

Environment variables

Quantities use Kubernetes units: m for milli-CPU, Mi and Gi for mebibytes and gibibytes. Leave a field blank to omit it.

The job runs on the cron schedule 0 2 * * * (minute hour day-of-month month day-of-week). Without spec.timeZone, the schedule is interpreted in the time zone of the kube-controller-manager, which is usually UTC. Concurrency is Forbid: Skip the new run if the previous job has not finished. No overlap.

Output

cronjob.yaml

Valid manifest
apiVersion: batch/v1
kind: CronJob
metadata:
  name: report-cleanup
  labels:
    app.kubernetes.io/name: report-cleanup
spec:
  schedule: 0 2 * * *
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1
  jobTemplate:
    spec:
      backoffLimit: 3
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: report-cleanup
              image: busybox:1.36
              imagePullPolicy: IfNotPresent
              command:
                - /bin/sh
                - "-c"
              args:
                - date; echo Cleaning up old reports
              env:
                - name: LOG_LEVEL
                  value: info
              resources:
                requests:
                  cpu: 100m
                  memory: 64Mi
                limits:
                  cpu: 200m
                  memory: 128Mi

kubectl

Apply and test

Apply the CronJob

kubectl apply -f report-cleanup.yaml

Trigger one run now (without waiting for the schedule)

kubectl create job --from=cronjob/report-cleanup report-cleanup-manual-001

How the schedule is read

  • The cron schedule has five fields: minute, hour, day-of-month, month, and day-of-week.
  • When both day-of-month and day-of-week are restricted, Kubernetes fires when either field matches, following classic cron behavior.
  • spec.timeZone sets the zone for the schedule. Without it, the controller-manager zone (usually UTC) applies.
  • Kubernetes does not accept the @every 1h style or a seconds field. Stick to the five standard fields or the @ nicknames.

Fields that keep jobs healthy

  • concurrencyPolicy decides what happens when a run is still going at the next tick: Allow, Forbid, or Replace.
  • backoffLimit caps how many times a failing Job retries before it is marked failed.
  • activeDeadlineSeconds and startingDeadlineSeconds stop jobs that run too long or start too late.
  • The history limits control how many finished Jobs are kept for inspection before they are garbage collected.

How to use

  1. Enter a name and a cron schedule, or click a preset like Daily 02:00 or Every 15 minutes. The schedule is validated against the five-field Kubernetes cron format as you type.
  2. Optionally set spec.timeZone so the schedule runs in a specific IANA zone, and choose a concurrency policy to control what happens when a run overlaps the next tick.
  3. Fill in the container image (use an explicit tag, not latest), then set the command and args. Quote any token that contains spaces, such as a /bin/sh -c script.
  4. Adjust retries, history limits, restart policy, environment variables, and CPU and memory requests and limits to match your workload. Watch the validation panel for errors and warnings.
  5. Copy the generated cronjob.yaml, save it to a file, and run the kubectl apply command shown below. Use the manual-trigger snippet to test one run without waiting for the schedule.

About this tool

Kubernetes CronJob Generator turns a cron schedule plus a container image and command into a complete, apply-ready CronJob manifest (apiVersion: batch/v1, kind: CronJob), the same shape kubectl emits, so you can save it as a file and run kubectl apply -f cronjob.yaml without hand-editing indentation. It is built for the everyday task of scheduling recurring work on a cluster: a nightly cleanup, an hourly export, a database backup, a report mailer. The schedule field is validated against the five-field cron format Kubernetes actually uses (minute, hour, day-of-month, month, day-of-week) with the standard operators (lists, ranges, and steps) plus the Vixie nicknames Kubernetes accepts (@yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly). Each field is range-checked, and on a bad expression the tool names the exact field and reason rather than silently rewriting it. Because Kubernetes does not accept the robfig @every duration syntax or a seconds field, those are flagged with a clear explanation instead of producing a manifest a cluster would reject. The form exposes the fields that decide whether scheduled jobs stay healthy: concurrencyPolicy (Allow, Forbid, or Replace) to control overlap when a run is slow, spec.timeZone to interpret the schedule in a named IANA zone on clusters running 1.27 or newer, suspend to pause scheduling, successfulJobsHistoryLimit and failedJobsHistoryLimit to bound how many finished Jobs are kept, startingDeadlineSeconds for missed-start tolerance, and the Job-level backoffLimit and activeDeadlineSeconds plus the pod restartPolicy (OnFailure or Never) for retry and timeout behavior. The container section takes the image, an optional imagePullPolicy, a command that overrides the image ENTRYPOINT, args that override CMD, environment variables, and CPU and memory requests and limits in Kubernetes quantity units. The command and args inputs are tokenized with a shell-style parser that honors single and double quotes and backslash escaping, so /bin/sh -c with a quoted script becomes a correct argv array. The YAML is produced by a deterministic writer that only quotes the scalar values YAML requires, such as the empty string, leading-indicator characters, or strings that would otherwise parse as numbers or booleans, which keeps the output readable and stable. Validation runs continuously with error, warning, and informational levels: the name is checked against the DNS-1123 label rules and the 52-character CronJob limit (the controller appends a suffix to generated Job names), an untagged or latest image is flagged as non-reproducible, resource quantities are sanity-checked, and a frequent schedule combined with Allow concurrency triggers a pile-up warning. Ready-to-run kubectl snippets for applying the manifest and for triggering a single manual run from the CronJob are generated alongside the YAML. Everything is computed in your browser, so the image, command, environment values, and schedule you enter are never uploaded, logged, or sent anywhere.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools