DELAPARRA
Index
Color
NL
Category: Kubernetes

CronJob

Explained by Updated

What is CronJob?

CronJob: Creates Jobs on a cron schedule. The Kubernetes equivalent of crontab — for backups, reports, and periodic cleanup. A CronJob in Kubernetes runs a task on a schedule, like the classic crontab on Linux servers. It creates a Job at the set times, such as 0 3 * * * for every night at three.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about CronJob

How is CronJob used in practice?

Typical uses are backups, report generation, cleaning up old data and syncing with external systems. Each run gets its own pod, which starts, does its work and stops.

What should you keep in mind with CronJob?

Set concurrencyPolicy: Forbid if two runs must never overlap, for example a backup that takes longer than expected. Keep a few finished jobs with successfulJobsHistoryLimit so you can read their logs. And monitor them. A CronJob that silently fails every night looks exactly like one that works, until the day you need that backup.

What does an example of CronJob look like?

apiVersion: batch/v1 kind: CronJob metadata: name: nightly-backup spec: schedule: "0 2 * * *" jobTemplate: spec: template: spec: restartPolicy: OnFailure containers: - name: backup image: backup-tool:2.0

At a glance

CategoryKubernetes
Explained by
Updated

More Kubernetes terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.