kubernetes
Kubernetes CronJob Generator
Generate a Kubernetes CronJob YAML for scheduled tasks — database backups, report generation, cache warming, or any periodic job.
Kubernetes CronJobs
CronJobs use standard Unix cron syntax to schedule Pods at regular intervals.
Cron Schedule Syntax
┌──────── minute (0–59)
│ ┌───── hour (0–23)
│ │ ┌── day of month (1–31)
│ │ │ ┌─ month (1–12)
│ │ │ │ ┌ day of week (0–6, Sun=0)
│ │ │ │ │
* * * * *Common Schedules
| Schedule | Meaning |
|---|---|
0 2 * * * | Daily at 2:00 AM |
0 * * * * | Every hour |
*/15 * * * * | Every 15 minutes |
0 2 * * 0 | Weekly, Sunday at 2 AM |
0 2 1 * * | Monthly, 1st at 2 AM |
Manually Trigger a CronJob
kubectl create job --from=cronjob/my-cronjob manual-run-$(date +%s) -n defaultSuspend a CronJob Temporarily
kubectl patch cronjob my-cronjob -p '{"spec": {"suspend": true}}'
# Resume:
kubectl patch cronjob my-cronjob -p '{"spec": {"suspend": false}}'Key Terms
Full glossary →kubeadm
A tool for bootstrapping Kubernetes clusters. It automates the setup of control plane components and joining worker nodes, following Kubernetes best practices.
etcd
A distributed key-value store used by Kubernetes to store all cluster state and configuration. etcd is the single source of truth for the entire cluster.
cert-manager
A Kubernetes controller for automating TLS certificate management. cert-manager can issue certificates from Let's Encrypt, Vault, or internal CAs, and automatically renews them.
Helm
A package manager for Kubernetes. Helm charts bundle Kubernetes manifests into reusable packages with configurable values, versioned and published to chart repositories.
Frequently Asked Questions
What does the concurrency policy do?
It controls what happens if a CronJob is still running when the next scheduled run is due. Forbid (recommended) skips the new run — safe for backup jobs where overlapping runs would cause conflicts. Allow lets runs overlap — fine for idempotent jobs. Replace cancels the current run and starts a fresh one — use for jobs where only the latest result matters.
What is the difference between a CronJob and a Job?
A Job runs once and completes. A CronJob is a controller that creates a new Job on a schedule — essentially a cron daemon for Kubernetes. When a CronJob fires, it creates a Job object, which in turn creates a Pod. You can manually trigger a CronJob with: kubectl create job --from=cronjob/<name> <manual-name>.
How do I debug a failed CronJob?
Check the Job and Pod history: kubectl get jobs -n <namespace> — this shows recent runs. kubectl describe job <job-name> — shows pod status. kubectl logs <pod-name> — shows job output. Note: with failedJobsHistoryLimit: 1 (the default), you only keep 1 failed pod for inspection. Increase it during debugging.
CronJob isn't running at the expected time — why?
CronJob times are in the cluster's timezone (usually UTC). If your schedule is 0 2 * * * expecting 2am local time but the cluster is UTC, adjust for the offset. Also check: kubectl get cronjob <name> — the 'LAST SCHEDULE' and 'ACTIVE' columns. If LAST SCHEDULE shows 'never', the CronJob hasn't fired yet or the controller is behind. Missed schedules more than startingDeadlineSeconds ago are skipped.
Related Guides
kubernetes
CI/CD for Kubernetes with GitHub Actions: A Complete Guide (2026)
A practical walkthrough of building a full GitHub Actions pipeline that builds a container image, pushes it to a registry, and deploys to Kubernetes — with secrets handling, rollback, and Helm support.
kubernetes
ArgoCD vs Flux: Choosing a GitOps Tool for Kubernetes in 2026
A no-fluff comparison of ArgoCD and Flux for GitOps on Kubernetes — covering architecture, UI, Helm support, multi-tenancy, and when to pick each one.
kubernetes
Hetzner vs DigitalOcean for Kubernetes in 2026: An Honest Comparison
Hetzner is 3–5× cheaper than DigitalOcean for equivalent Kubernetes compute. But DO has managed K8s, better global coverage, and a larger app marketplace. Here's when each is the right choice.