Skip to content
migration.tools
crontab to Kubernetes CronJob

Crontab to Kubernetes CronJob converter

Moving scheduled jobs from a server's crontab into a cluster? Each line becomes a batch/v1 CronJob manifest with the same schedule, the command wrapped in a shell, and a sensible concurrency policy.

Options
The image that contains your script.

crontab

CronJob YAML

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Paste your crontab or drop a file onto the input panel.
  2. 2Adjust the options — the result updates as you type.
  3. 3Copy the Kubernetes CronJob or download it. Drop several files to convert a batch into one ZIP.

What the manifest sets

schedule is your cron expression unchanged — Kubernetes uses standard five-field syntax. concurrencyPolicy: Forbid stops a slow run from overlapping the next one, the usual expectation for jobs that used to run under cron. restartPolicy: OnFailure retries a failed run.

The command is run with /bin/sh -c in the image you name. A script that lived on the old server has to be baked into an image, or mounted from a ConfigMap, before the CronJob can run it.

Questions

How do I set a time zone?

Add spec.timeZone (for example "Europe/Berlin") to the CronJob — supported since Kubernetes 1.27. Without it the schedule is evaluated in the controller's time zone, normally UTC.

Guides that use this tool