Containers · Kubernetes Workloads
Jobs and CronJobs
Cheat sheet · https://pcornel.dk/topic.php?topic=6147
Answer
Jobs run pods to completion with retries (backoffLimit); CronJobs create Jobs on a cron schedule.
Remember
Check concurrencyPolicy, startingDeadlineSeconds and history limits. Failed pods keep logs only while retained. The CronJob schedule uses the controller's time zone unless timeZone is set.
First checks
kubectl get cronjob,job -n <ns>— first check for this topickubectl get pods -o wide— pods, status, node, IPkubectl describe pod <pod>— events and conditionskubectl logs <pod> [-c <c>] [--previous]— container logs (incl. previous crash)kubectl get events --sort-by=.lastTimestamp— recent cluster events
Commands
kubectl get cronjob,jobkubectl create job --from=cronjob/db-backup manual-1
Verify in this order
CronJob schedule → Job → pod runs to completion → success/fail recorded
Where it usually breaks
restartPolicy Always is not allowed in a Job.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6147