TechCompare LogoTechCompare

Kubernetes CronJob syntax: how K8s cron scheduling differs from Linux cron

Kubernetes CronJobs are the standard way to run scheduled workloads in K8s. The cron syntax is identical to Linux. The concurrency, history, and deadline policies are where you need to think differently from a traditional crontab. Always set concurrencyPolicy and history limits explicitly.

Kubernetes CronJobs use the standard 5-field cron syntax with one addition: an optional timezone field (schedule: '0 0 * * *' and timezone: 'America/New_York'). The expression format is identical to Linux cron, which means every cron tutorial you already know transfers directly to K8s.

By TechCompare · Updated

Schedule pattern
Kubernetes CronJob
kubernetes
Category
Platforms
Cloud and container scheduling

How this is calculated

Kubernetes adds three features on top of standard cron: concurrencyPolicy (Forbid, Replace, or Allow) controls what happens when a previous job is still running, successfulJobsHistoryLimit and failedJobsHistoryLimit control how many completed job pods are retained, and startingDeadlineSeconds sets a tolerance for missed schedules. The biggest operational difference is that Kubernetes CronJobs create a new Pod for every invocation, which means 288 Pods per day for an every-5-minutes job. Use a concurrencyPolicy of Forbid for jobs that must not overlap, and set history limits to avoid accumulating thousands of completed Job objects.

Verdict

The cron string is portable, but Kubernetes changes the operational model in ways that matter. Each invocation spawns a fresh Pod, so an every-5-minutes schedule creates 288 Pods daily. Forbid on concurrencyPolicy prevents overlap, and tight successfulJobsHistoryLimit and failedJobsHistoryLimit stop Job objects from piling up in etcd. startingDeadlineSeconds handles missed schedules gracefully.

More Cron scenarios

Frequently asked questions

Is Kubernetes CronJob syntax the same as Linux cron?
The 5-field schedule format is identical, so everything you know about 0 0 * * * carries over directly. K8s adds an optional timezone field on the CronJob spec, which Linux cron lacks at the job level. The operational model is what actually differs: every invocation creates a fresh Pod instead of a process on a long-lived host.
What does concurrencyPolicy do on a Kubernetes CronJob?
It controls overlap when a previous run is still going. Forbid skips the new run entirely (the safe default for jobs that must not run twice), Replace kills the old Pod and starts fresh, and Allow lets both run. An every-5-minutes job with Allow and no internal locking will stack up Pods the moment any run exceeds 5 minutes.
How do I stop completed CronJob pods from piling up?
Set successfulJobsHistoryLimit and failedJobsHistoryLimit on the CronJob spec, typically 3 and 1. Without limits, an every-5-minutes job leaves 288 completed Job objects a day accumulating in etcd forever, which eventually slows the cluster's API. Also set startingDeadlineSeconds so a suspended or delayed CronJob doesn't fire a burst of catch-up runs.