Interview Prep/Kubernetes/Pods & Workloads

What is the difference between a Job and a CronJob?

BeginnerConceptPods & Workloads
Answer

A Job runs Pods to completion (one-off batch work, with completions, parallelism and backoffLimit). A CronJob creates Jobs on a cron schedule. Use restartPolicy: OnFailure or Never for Job Pods, never Always.

kubectl create cronjob nightly --image=busybox --schedule="0 2 * * *" -- /bin/sh -c "date"
All Kubernetes questions Roadmap: Kubernetes core

More on Pods & Workloads