Use this when running scheduled jobs in Kubernetes.
CronJobs
CronJobs run Kubernetes Jobs on a cron schedule, such as nightly backups or reports, with settings for concurrency, history limits and starting deadlines.
1. CronJobs schedule Jobs.
2. concurrencyPolicy Forbid to avoid overlap.
3. timeZone field (1.27+).
4. History limits.
5. Monitor failures.
schedule → Job → pods
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as schema drift, selector overreach, admission rejection, controller lag, immutable fields, stale status and confusing created object with ready workload, choosing the cases most relevant to schedule expression, timeZone, concurrencyPolicy, startingDeadlineSeconds, suspend, Job creation and missed/overlapping runs.
Step 2 Example Narrow the fault
spec:
schedule: "0 2 * * *"
timeZone: "Europe/Copenhagen"
concurrencyPolicy: Forbid
Step 3 Common mistakes Narrow the fault
- Missing
concurrencyPolicy, causing overlapping runs.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- CronJobs create Jobs on a cron schedule.
- concurrencyPolicy controls overlaps.
- History limits keep old Jobs manageable.
kubectl get cronjobs -n <ns>— cronjobskubectl create job --from=cronjob/<n> test-run— manual test run- concurrencyPolicy and startingDeadlineSeconds — behaviour
ReferenceWhy it matters1 section · depth on demand
In depth
A CronJob creates Jobs on a schedule using cron syntax — nightly backups, periodic compliance scans, certificate checks. It inherits all Job behaviour and adds scheduling controls.
apiVersion: batch/v1
kind: CronJob
metadata: { name: config-backup }
spec:
schedule: "30 2 * * *"
timeZone: "Europe/Copenhagen"
concurrencyPolicy: Forbid
startingDeadlineSeconds: 600
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 5
jobTemplate:
spec:
backoffLimit: 2
template:
spec:
restartPolicy: OnFailure
containers: [{ name: backup, image: registry.example.com/net-backup:3.0 }]
concurrencyPolicy: Forbid prevents overlapping runs. Trigger a test run manually with kubectl create job --from=cronjob/config-backup test-run.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
The linked authority for bounded mechanics is Kubernetes Docs — CronJob; documentation support is separate from observed lab/production Evidence.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Kubernetes Automation > CronJobs. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For schedule expression, timeZone, concurrencyPolicy, startingDeadlineSeconds, suspend, Job creation and missed/overlapping runs, prefer typed fields and stable IDs over human presentation text.