Practical technical guides / Core IT: Kubernetes (CronJob controller)

A Kubernetes CronJob Skipped Its Run: startingDeadlineSeconds, concurrencyPolicy and the 100 Missed Schedules Warning

Kubernetes v1.37.2 starts only the latest missed CronJob time; over 100 adds a warning, under 100 nothing. Forbid, Replace and deadline traps, and how to catch up.

By Sandeep Belgavi · Published 2026-11-08

Which missed CronJob times still start
Original explanatory diagram; synthetic values where shown.

Kubernetes v1.37.2 starts only the latest missed CronJob time; over 100 adds a warning, under 100 nothing. Forbid, Replace and deadline traps, and how to catch up.

The nightly report that ran once instead of twice

Dinky owns a reconciliation CronJob at Belgavi's Book Store that compares the day's book orders with payments every hour. During a control-plane upgrade the kube-controller-manager was unavailable for two days. When it came back, the CronJob ran once. Forty-eight hourly reconciliations never happened, there was no warning event, and the dashboard showed a successful run at the top of the hour.

That is the CronJob controller working as written. This guide reads the controller at Kubernetes v1.37.2 (released 28 October 2026), explains exactly when a scheduled time becomes a Job and when it silently does not, and turns that into configuration and monitoring. The interactive lab replays the controller's decisions over a timeline you control. Nothing here was run on a cluster; the behaviour comes from the source and the documentation cited at the end.

How the controller decides

The decision lives in pkg/controller/cronjob. On each sync, syncCronJob calls nextScheduleTime, which calls mostRecentScheduleTime. Simplified:

  1. Start from status.lastScheduleTime, or the CronJob's creation time if it has never run.
  2. If startingDeadlineSeconds is set and now - deadline is later, start from there instead.
  3. Compute the first schedule time after that point (t1) and the one after it (t2). If now is before t1, nothing is due. If it is before t2, t1 is due.
  4. Otherwise count the missed times as (now - t1) / interval + 1 and take the latest schedule time not after now.
  5. If the count is above 100, record a TooManyMissedTimes warning event.

Then syncCronJob creates one Job, for the most recent time. The earlier missed times are not queued, retried or recorded anywhere. The source comment explains why: a wrong clock could make the count enormous, and listing every missed time "would eat up all the CPU and memory of this controller".

Older Kubernetes versions behaved differently, and many blog posts still describe them: the original controller, which v1.21 replaced with the current one by default, gave up when more than 100 times were missed, started nothing and recorded a FailedNeedsStart event, "Cannot determine if job needs to be started". In v1.37.2, more than 100 missed times only adds a warning; the most recent time still starts. Under 100, there is no event at all.

Four ways to lose a run

SituationWhat the controller doesSignal you get
Controller down or CronJob suspended for N intervalsstarts the latest missed time onlyTooManyMissedTimes if N > 100, otherwise nothing
concurrencyPolicy: Forbid and the previous Job is still runningskips, leaves lastScheduleTime unchangedJobAlreadyActive event
concurrencyPolicy: Replace and the Job is slower than the intervaldeletes the running Job and starts a new oneSuccessfulDelete; no Job ever finishes
startingDeadlineSeconds shorter than the controller's reaction timenothing due inside the windownone

The lab's presets reproduce each row. Two are worth walking through.

Forbid with a slow Job. A Job every 5 minutes takes 12. At minute 10 and 15 the controller records JobAlreadyActive and does not move lastScheduleTime. When the first Job finishes at minute 17, the next sync finds two due times since the last schedule (10 and 15) and starts a Job for minute 15, two minutes late. The run for minute 10 never happens. Over 40 minutes, 3 of 8 scheduled times start a Job, two of them late. Adding startingDeadlineSeconds: 60 removes the late starts, because a time more than a minute old is no longer considered; the Job waits for the next scheduled time instead.

A deadline shorter than the reaction time. With startingDeadlineSeconds: 5 and a controller that acts 15 seconds after each scheduled time, step 2 moves the starting point past the scheduled time, so step 3 finds nothing due. No Job starts and, in this reading of the code, no event is recorded. syncCronJob does contain a MissSchedule event for a time that is too late to start, but because mostRecentScheduleTime has already applied the deadline, that branch is not reached for ordinary schedules in the model. The documentation warns that a deadline under 10 seconds may prevent a CronJob from being scheduled; treat it as a hard rule and keep the deadline well above any controller lag you have seen.

Configuration that makes the behaviour deliberate

apiVersion: batch/v1
kind: CronJob
metadata:
  name: hourly-reconcile
spec:
  schedule: "0 * * * *"
  timeZone: "Asia/Kolkata"
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 600      # a run more than 10 minutes late is skipped, not started
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 5
  jobTemplate:
    spec:
      activeDeadlineSeconds: 3000   # a run cannot overlap the next one by much
      backoffLimit: 2
      template:
        spec:
          restartPolicy: Never
          containers:
          - name: reconcile
            image: registry.example.internal/reconcile@sha256:0f3c...
            env:
            - name: JOB_NAME                # hourly-reconcile-<minutes since the epoch>
              valueFrom:
                fieldRef:
                  fieldPath: metadata.labels['batch.kubernetes.io/job-name']
            args: ["--job-name=$(JOB_NAME)"]

Three choices matter here. Forbid plus a deadline means a slow run cannot cause a late, overlapping one. activeDeadlineSeconds on the Job bounds how long one run can block the next. And the Job should process a window defined by its scheduled time, not by when it happens to start, so a late start still covers the right hour.

Kubernetes does not pass the scheduled time to the container directly. The controller names each Job after it: the CronJob name plus the scheduled time in minutes since the Unix epoch (getTimeHashInMinutes in the source). The API server copies the Job name into the pod template as the batch.kubernetes.io/job-name label, and the downward API can expose a pod label as an environment variable, so the entrypoint above reads JOB_NAME, takes the number after the last hyphen and multiplies it by 60 to get the scheduled time in seconds. The controller also annotates the Job itself with batch.kubernetes.io/cronjob-scheduled-timestamp, but that annotation is on the Job, not the pod, so the downward API cannot read it; use it from tooling that reads Jobs.

Catching up belongs to the job, not the controller

If every hourly window must be processed, do not rely on one Job per scheduled time. Make each run idempotent over a window and have it catch up:

  1. Keep a durable record of the last window that completed, for example a row in the reconciliation database.
  2. On each run, process every complete window from that record up to the scheduled time, oldest first, committing the record after each.
  3. Bound the catch-up per run, and alert if the backlog is more than a few windows.

With that design a two-day outage produces one long run that processes 48 windows, and Forbid stops the next scheduled Job from overlapping it. The CronJob becomes a trigger, and correctness lives in the job's own state.

Monitoring that sees skipped runs

Events expire after an hour by default and the quiet cases produce none, so alert on state instead:

  • status.lastSuccessfulTime older than two intervals, per CronJob. kube-state-metrics exposes the CronJob status times as metrics for this.
  • status.lastScheduleTime older than one interval plus the deadline, which catches a controller that is not scheduling at all.
  • The job's own "last completed window" record, which is the only signal that a catch-up design is keeping up.
  • JobAlreadyActive and TooManyMissedTimes events, collected to logs if you keep events, as context rather than as the primary alert.

Failure modes to test

  • Suspend and resume. Setting suspend: true for a maintenance window and back to false later behaves like controller downtime: one Job for the latest time. In the lab, a 190-minute suspension of a per-minute schedule produces a TooManyMissedTimes warning and one start.
  • Replace on a slow Job. Every run is deleted before it finishes. Use Replace only for work where a newer run makes the older one worthless and the run is well under the interval.
  • Time zones. Without timeZone, the schedule follows the controller manager's time zone. Set it explicitly.
  • Clock skew. A controller clock that jumps forward produces a large missed count; the warning event mentions clock skew for that reason.

Using the lab

Start from controller_down_no_deadline, which mirrors the documentation's example of a per-minute CronJob whose controller is down for nearly two hours, and set the deadline to 200: the warning disappears but the outcome is identical, one start for the latest minute. Then load forbid_long_job and change the policy to Allow and Replace to see the three policies on the same timeline. The decision trace lists each sync, which branch the controller took and why.

Interactive experiment

CronJob missed schedules: deadlines, concurrency policy and controller downtime. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.

Primary references and authorship

Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/cronjob_schedule_model. Views are my own and do not represent any employer, past or present.