Example Documentation: Kubernetes Jobs and CronJobs
Goal
Understand batch workloads with bounded runtime, logs, retry rules and automatic cleanup.
What Is Done
The lab creates a one-time Job that calculates a checksum and a CronJob that creates report Jobs every 15 minutes.
Typical Commands
kubectl apply -f manifests/
kubectl get job,cronjob,pod -n batch-lab
kubectl logs -n batch-lab job/checksum-once
kubectl describe cronjob cleanup-report -n batch-lab
Validate Success
checksum-oncereachesComplete.- Logs contain a SHA-256 checksum.
- The CronJob shows schedule, history limits and concurrency policy.
Common Mistakes
restartPolicyis missing or does not fit the Job type.- The cron expression is too aggressive for training clusters.
- Missing history limits allow old Jobs to accumulate.