Kubernetes CronJob

⎈ Kubernetes CronJob, decoded.

Kubernetes CronJob uses standard 5-field cron. Without .spec.timeZone the schedule follows the kube-controller-manager’s time zone (usually UTC); the field is on by default from v1.25 and stable since v1.27. Generates complete YAML you can kubectl apply -f.

Kubernetes CronJob Generator

Translation …
    
              
            
    How Kubernetes CronJob differs from Linux cron. Day of week: 0-6; 7 is rejected. Time zone: .spec.timeZone (stable since 1.27); without it, the kube-controller-manager’s local zone. Compare Kubernetes CronJob with Linux cron, side by side →
    Worked examples

    Common Kubernetes CronJob schedules.

    ExpressionWhat it meansTypical use
    */5 * * * * Every 5 minutes Frequent health checks, queue processing.
    0 2 * * * Every day at 2 AM Nightly backups (low-traffic window).
    0 */6 * * * Every 6 hours Periodic cleanup tasks, data refreshes.
    0 0 * * 0 Every Sunday at midnight Weekly batch processing.
    0 0 1 * * First of every month Monthly rotation jobs.
    @daily Macro: every day at midnight Convenient shorthand.

    Click any expression to load it into the tool above.

    Common questions

    Kubernetes CronJob FAQs.

    In Kubernetes v1.27+, add spec.timeZone: "America/New_York" at the CronJob spec level. On clusters older than 1.25, write the schedule in the controller's time zone (usually UTC); setting TZ in the container only changes what your program sees.

    Three common causes: (1) the controller is rate-limited (check kube-controller-manager logs), (2) spec.startingDeadlineSeconds is too small and the missed run was abandoned, (3) spec.concurrencyPolicy is Forbid and a previous run is still active.

    Job runs once. CronJob creates Job objects on a schedule. You can think of CronJob as a Job factory that fires based on its cron expression.

    kubectl get jobs: Jobs created by a CronJob are named after it (my-cronjob-<number>), and kubectl describe cronjob my-cronjob lists the active ones. CronJob keeps recent Jobs around (controlled by successfulJobsHistoryLimit and failedJobsHistoryLimit, default 3 and 1).

    Yes: kubectl create job --from=cronjob/my-cronjob manual-run-001 creates a one-off Job from the CronJob's template.