How to check if a Kubernetes CronJob ran
A CronJob that stops running breaks nothing right away: the problem shows up days later, in the report that never came out or the backup that does not exist. These are the commands to check it, and the most common reasons a CronJob does not run.
1. The last scheduled run
The LAST SCHEDULE column shows when the CronJob created its last Job, and SUSPEND shows whether it is paused:
kubectl get cronjob -n <namespace> 2. The last successful run
The CronJob status keeps the last time a Job was scheduled and the last time one finished successfully:
kubectl get cronjob <name> -n <namespace> \
-o jsonpath='{.status.lastScheduleTime}{"\n"}{.status.lastSuccessfulTime}{"\n"}' 3. The Jobs it created, and which ones failed
Every run is a Job. List the most recent ones and check each one’s status and completions:
kubectl get jobs -n <namespace> --sort-by=.metadata.creationTimestamp
kubectl describe job <job> -n <namespace>
kubectl logs job/<job> -n <namespace> Why a CronJob does not run
- spec.suspend is true.
- concurrencyPolicy: Forbid and the previous Job is still running, so the new run is skipped.
- startingDeadlineSeconds is too short: if the controller cannot start within the deadline, that run is lost.
- More than 100 missed runs since the last one: the controller records a warning event about too many missed start times and may not start the Job.
- The time zone: without spec.timeZone, the schedule follows the kube-controller-manager time zone, usually UTC.
- Low successfulJobsHistoryLimit and failedJobsHistoryLimit delete the Job history before you look.
Without a terminal, in Kubepier
In Kubepier, the CronJobs list shows each one’s last run and whether it is suspended, and the Jobs list shows which ones completed, failed or are still running, from any cluster, in the browser or on your phone.