opyebCronPulse

Kubernetes CronJob time zones and missed schedules

Platforms · 7 min read

One-line answer: How timeZone, startingDeadlineSeconds and concurrencyPolicy decide whether a CronJob actually runs.

Kubernetes CronJob is convenient until its defaults surprise you. The three settings that decide whether a job really runs are the time zone, the allowed lateness, and the concurrency policy.

The default zone may be UTC

Early CronJobs used the kube-controller-manager's local time zone, which is UTC in most clusters. Since Kubernetes 1.27, spec.timeZone accepts an IANA time zone. If it is unset, the cluster default applies, so 0 9 * * * may be 09:00 UTC rather than 09:00 local. Always check.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: nightly-report
spec:
  schedule: "0 9 * * *"
  timeZone: "Asia/Seoul"
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 300
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: report
            image: example/report:1.2.3

Missed schedules

The controller evaluates schedules periodically, so a node failure or controller delay can miss a run. startingDeadlineSeconds is how late a missed run may still start. Left unset, lateness is effectively unlimited and a recovering cluster can fire a queue of stale jobs. Set it too short and ordinary delays skip valid runs.

The controller also stops creating jobs after counting more than 100 missed schedules, logging an error instead. A per-minute job left paused for a long weekend can reach that limit.

Concurrency policy

ValueBehaviourFits
AllowStart the new job even if the old one runsIndependent jobs
ForbidSkip the new run while the old one runsJobs that must not overlap
ReplaceStop the old job and start the new oneSync jobs where only the latest matters

The default is Allow. For nightly settlement or billing, change it to Forbid. That also adds a layer of protection against the repeated hour when daylight saving ends.

Daylight saving

With a DST zone in timeZone, spring skips a wall-clock time and autumn can schedule the same one twice. Forbid plus an idempotency key prevents duplication. Prefer schedules after 04:00 or in UTC.

Checklist

  • Is spec.timeZone set explicitly?
  • Does startingDeadlineSeconds match the business tolerance for lateness?
  • Does concurrencyPolicy prevent overlap where it matters?
  • Can you see logs and events for failed Jobs?

Paste an expression and see its next run times right away.

Open CronPulse

Frequently asked questions

A CronJob stopped firing. What do I check first?

Start with kubectl describe cronjob: Events and Last Schedule Time. Then check schedule syntax, the time zone, whether startingDeadlineSeconds was exceeded, and whether the concurrency policy skipped runs.

Can a CronJob run every few seconds?

No, CronJob is minute-granular. Use a worker or an application timer for sub-minute work and keep the CronJob for supervision and restart.

Sources

Related reading