Fix Kubernetes CronJob TooManyMissedTimes (100 Missed Schedules Limit)

Understand how Kubernetes CronJob calculates missed runs from lastScheduleTime, why 100 missed ticks halt scheduling, and how to tune startingDeadlineSeconds.

Kubernetes CronJob Concepts: Starting Deadline & Missed Scheduleskube-controller-manager cronjob_controllerv2 (100 Missed Runs Cap)

Incident Symptom & Protocol Root Cause

Production Failure Symptom

After suspending a high-frequency CronJob over a weekend (suspend: true -> false) or recovering from a control-plane outage, the CronJob refuses to create any new pods and emits Warning TooManyMissedTimes: 'Cannot determine if job needs to be started. Too many missed start time (> 100). Set or decrease .spec.startingDeadlineSeconds or check clock skew.'

Scheduler Parser & Clock Mechanics

When startingDeadlineSeconds is unset, the Kubernetes CronJob controller counts missed schedule ticks all the way back to .status.lastScheduleTime. If more than 100 scheduled intervals elapsed (for example 101 minutes on a * * * * * CronJob), the controller aborts scheduling for that tick and logs an error rather than flooding the cluster.

Broken vs Verified Configuration

Broken1-Minute CronJob Without startingDeadlineSeconds
apiVersion: batch/v1
kind: CronJob
metadata:
  name: queue-outbox-poller
spec:
  schedule: "*/1 * * * *"
  # Unset startingDeadlineSeconds!
  # If suspended or offline for >100 minutes, un-suspending triggers TooManyMissedTimes!
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: poller
              image: registry.internal/outbox-poller:1.2.0
Verified FixBounded startingDeadlineSeconds Window (200s < 100 Ticks)
apiVersion: batch/v1
kind: CronJob
metadata:
  name: queue-outbox-poller
spec:
  schedule: "*/1 * * * *"
  # Controller only counts missed ticks within the last 200 seconds (~3 ticks << 100!)
  # Must be >= 10s because CronJob controller reconciles every 10 seconds.
  startingDeadlineSeconds: 200
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      activeDeadlineSeconds: 55
      template:
        spec:
          restartPolicy: Never
          containers:
            - name: poller
              image: registry.internal/outbox-poller:1.2.0

Operational Deep Dive

Kubernetes CronJob controller v2 runs a reconciliation loop roughly every 10 seconds. For each CronJob, it inspects the window from status.lastScheduleTime (or the CronJob creation timestamp) up to 'now'. If startingDeadlineSeconds is omitted, that lookback window is unbounded—so a per-minute CronJob that was paused for two hours accumulates 120 missed schedules, crossing the hardcoded 100-missed-runs safety fuse.

Setting startingDeadlineSeconds changes the lookback boundary dramatically! When startingDeadlineSeconds is set (say to 200 seconds), the controller ONLY counts missed schedules inside the last 200 seconds instead of all the way back to lastScheduleTime. On a 1-minute CronJob, at most 3 schedules can ever fit inside 200 seconds, making it mathematically impossible to hit the >100 missed-schedules error after un-suspending a job or recovering from downtime!

One critical minimum bound applies: never set startingDeadlineSeconds below 10 seconds! Because kube-controller-manager scans CronJobs on a 10-second tick, setting startingDeadlineSeconds: 5 means a job scheduled at 12:00:00 examined by the controller at 12:00:07 has already missed its 5-second deadline and will be permanently skipped almost every run. Keep startingDeadlineSeconds between 60 and 600 seconds for minute-level jobs, and 900 to 3600 seconds for hourly or daily batch jobs.

startingDeadlineSeconds Sizing Guide by Cron Frequency

Engine / CaseRuntime BehaviorProduction Remediation
startingDeadlineSeconds < 10CronJob skips most or all runs because the controller's 10-second sync loop arrives after the deadline expires.Always set startingDeadlineSeconds >= 60 (minimum safe floor above 10s controller sync).
Every 1 minute (*/1 * * * *)Unset deadline hits >100 missed limit after 1h 41m of suspension or control-plane outage.Set startingDeadlineSeconds: 180 (caps lookback at 3 ticks, prevents TooManyMissedTimes).
Every 5 minutes (*/5 * * * *)Unset deadline hits >100 missed limit after 8h 25m of suspension.Set startingDeadlineSeconds: 300 to 600.
Daily batch (0 4 * * *)Late start hours after maintenance window could collide with peak daytime traffic.Set startingDeadlineSeconds: 3600 (allow up to 1h late catch-up, skip if outage lasted longer).

Edge Cases & Engineering FAQs

How do I recover an existing CronJob stuck in TooManyMissedTimes without deleting job history?

Patch the CronJob to add spec.startingDeadlineSeconds (for example kubectl patch cronjob <name> -p '{"spec":{"startingDeadlineSeconds":300}}'). On the very next 10-second controller pass, the lookback window shrinks to 300 seconds and normal scheduling resumes immediately.

If 4 runs were missed inside startingDeadlineSeconds, will Kubernetes launch 4 catch-up pods at once?

No. Even when multiple ticks fall inside startingDeadlineSeconds, Kubernetes CronJob controller only schedules a single catch-up Job representing the most recent missed schedule time.

Does suspend: true update lastScheduleTime while paused?

No. While spec.suspend is true, lastScheduleTime remains frozen at the last run prior to suspension, which is why un-suspending a job without startingDeadlineSeconds frequently triggers TooManyMissedTimes.

Runtime Dead-Man's-Switch Verification

Heartbeat & Cron MonitoringBetter Stack →

Dead-man's-switch heartbeat checks that page on-call when a scheduled job skips a DST gap, stalls on a lock, or exits non-zero.