---
source: https://iinventedlight.com/library/notes/kubernetes-cronjobs.md
title: "Kubernetes CronJobs"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC BY 4.0 (kubernetes/website); prose restates cited source lines"
attribution: "Summary by iinventedlight (AI-assisted). Sources: Kubernetes Authors, CronJob, CC BY 4.0 (kubernetes/website); Kubernetes Authors, Running Automated Tasks with a CronJob, CC BY 4.0 (kubernetes/website)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: Kubernetes"
tags: ['kubernetes', 'cronjobs', 'scheduling', 'batch']
sources:
  - id: S1
    title: "CronJob"
    publisher: Kubernetes Authors
    url: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
    accessed: 2026-11-04
    license: "CC BY 4.0 (kubernetes/website)"
  - id: S2
    title: "Running Automated Tasks with a CronJob"
    publisher: Kubernetes Authors
    url: https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/
    accessed: 2026-11-04
    license: "CC BY 4.0 (kubernetes/website)"
---
# Kubernetes CronJobs

**Answer:** A CronJob creates Jobs on a repeating schedule written in cron syntax, for tasks like backups, report generation or cleanup. Each CronJob is like one line in a crontab file.

## Example

```yaml
apiVersion: batch/v1
kind: CronJob
metadata: {name: hello}
spec:
  schedule: "*/5 * * * *"
  timeZone: "America/Los_Angeles"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
          - name: hello
            image: busybox
            command: ["date"]
```

## Watch it

```bash
kubectl get cronjob hello
kubectl get jobs --watch
```

## Caveats

Jobs should be idempotent: in some circumstances a CronJob can create more than one Job for a schedule, or skip one.

## Claims
- id: C1
  claim: CronJob is meant for regular scheduled actions such as backups.
  source: S1
  evidence: "CronJob is meant for performing regular scheduled actions such as backups, report generation,"
- id: C2
  claim: One CronJob is like one line of a crontab file.
  source: S1
  evidence: "and so on. One CronJob object is like one line of a crontab (cron table)"
- id: C3
  claim: A single CronJob can create multiple concurrent Jobs.
  source: S1
  evidence: "For example, in certain circumstances, a single CronJob can create multiple concurrent Jobs."
- id: C4
  claim: The hello cron job scheduled a job at the specified time.
  source: S2
  evidence: "You should see that the cron job hello successfully scheduled a job at the time"

## Sources
- [S1] CronJob. Kubernetes Authors. https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ . License: CC BY 4.0 (kubernetes/website). Accessed 2026-11-04.
- [S2] Running Automated Tasks with a CronJob. Kubernetes Authors. https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/ . License: CC BY 4.0 (kubernetes/website). Accessed 2026-11-04.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
