kubectl Jobs & CronJobs commands
27 commands in 4 groups: Jobs Manage, CronJobs Manage, Jobs List & Inspect, CronJobs List & Inspect. Click or tap any command to copy it. Official documentation: kubernetes.io.
Open in the interactive cheat sheet search, stars and every other section
Jobs Manage
Create Jobs imperatively, trigger CronJobs manually, and clean up completed runs.
kubectl apply -f job.yaml
Apply Job from manifest
kubectl create job <name> --from=cronjob/<cron>
Trigger a CronJob manually as a one-off Job
kubectl create job <name> --image=<image>
Create a simple Job imperatively
kubectl delete job <name>
Delete Job and its Pods
kubectl delete jobs --all -n <namespace>
Delete all Jobs in a Namespace
CronJobs Manage
Create, edit, suspend, resume, and delete CronJobs.
kubectl apply -f cronjob.yaml
Apply CronJob from manifest
kubectl create cronjob <name> --image=<image> --schedule='*/5 * * * *'
Create a CronJob imperatively
kubectl delete cronjob <name>
Delete CronJob and the Jobs and Pods it created
kubectl delete cronjobs --all -n <namespace>
Delete all CronJobs in a Namespace
kubectl edit cronjob <name>
Edit CronJob in $EDITOR
kubectl patch cronjob <name> -p '{"spec":{"suspend":false}}'
Resume a suspended CronJob
kubectl patch cronjob <name> -p '{"spec":{"suspend":true}}'
Suspend a CronJob (stops new runs)
Jobs List & Inspect
List Jobs, inspect their status, and find the Pods they created.
kubectl describe job <name>
Full Job details, Pod statuses, and events
kubectl get jobs
List Jobs in current Namespace
kubectl get job <name> -o yaml
Get Job manifest as YAML
kubectl get jobs -A
List all Jobs across all Namespaces
kubectl get jobs -n <namespace>
Jobs in a specific Namespace
kubectl get pods --selector=job-name=<name>
Find all Pods created by a Job
kubectl logs -l job-name=<name>
Last 10 lines from each Pod of a Job (add --tail=-1 for all)
kubectl wait --for=condition=Failed job/<name>
Wait until Job fails (useful in CI to catch errors)
kubectl wait --for=condition=Complete job/<name> --timeout=120s
Wait until Job completes successfully
CronJobs List & Inspect
List CronJobs, check their schedule and last execution, and view the full spec.
kubectl describe cronjob <name>
Schedule, last run time, and events
kubectl get cj
Short alias for get cronjobs
kubectl get cronjobs
List CronJobs in current Namespace
kubectl get cronjob <name> -o yaml
Get CronJob manifest as YAML
kubectl get cronjobs -A
List all CronJobs across all Namespaces
kubectl get cronjobs -n <namespace>
CronJobs in a specific Namespace