πŸ“šBook Signing at KubeCon EU 2026Meet us at Booking.com HQ (Mon 18:30-21:00) & vCluster booth #521 (Tue 24 Mar, 12:30-1:30pm) β€” free book giveaway!RSVP Booking.com Event
Deployments intermediate ⏱ 15 minutes K8s 1.28+

Kubernetes CronJob Scheduling Guide

Schedule recurring tasks with Kubernetes CronJobs. Covers cron syntax, timezone support, concurrency policies, job history, manual triggers, and monitoring.

By Luca Berton β€’ β€’ πŸ“– 5 min read

πŸ’‘ Quick Answer: deployments

The Problem

This is one of the most searched Kubernetes topics with thousands of monthly searches. A comprehensive, production-ready guide prevents hours of trial and error.

The Solution

CronJob Basics

apiVersion: batch/v1
kind: CronJob
metadata:
  name: report-generator
spec:
  schedule: "30 8 * * 1"          # 8:30 AM every Monday
  timeZone: "America/New_York"    # K8s 1.27+
  concurrencyPolicy: Forbid
  suspend: false                   # Set true to pause
  successfulJobsHistoryLimit: 5
  failedJobsHistoryLimit: 3
  startingDeadlineSeconds: 600
  jobTemplate:
    spec:
      backoffLimit: 2
      activeDeadlineSeconds: 1800  # 30 min timeout
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: report
              image: report-gen:v1
              resources:
                requests:
                  cpu: 500m
                  memory: 512Mi

Concurrency Policies

PolicyBehavior
Allow (default)Multiple jobs can run simultaneously
ForbidSkip new job if previous still running
ReplaceKill running job, start new one
# Manage CronJobs
kubectl get cronjobs
kubectl describe cronjob report-generator

# Manual trigger (bypass schedule)
kubectl create job --from=cronjob/report-generator manual-report

# Suspend / Resume
kubectl patch cronjob report-generator -p '{"spec":{"suspend":true}}'
kubectl patch cronjob report-generator -p '{"spec":{"suspend":false}}'

# Check recent jobs
kubectl get jobs --sort-by=.metadata.creationTimestamp

Cron Syntax

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€ minute (0-59)
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€ hour (0-23)
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€ day of month (1-31)
β”‚ β”‚ β”‚ β”Œβ”€β”€β”€ month (1-12)
β”‚ β”‚ β”‚ β”‚ β”Œβ”€ day of week (0-6, Sun=0)
β”‚ β”‚ β”‚ β”‚ β”‚
* * * * *
ExampleMeaning
0 0 * * *Midnight daily
*/15 * * * *Every 15 minutes
0 9,17 * * 1-59AM and 5PM weekdays
0 0 1,15 * *1st and 15th of month
@hourlyEvery hour (shorthand)
@dailyOnce a day
@weeklyOnce a week
graph TD
    A[CronJob controller] -->|Schedule matches| B[Create Job]
    B --> C[Create Pod]
    C -->|Success| D[Completed]
    C -->|Fail| E{backoffLimit?}
    E -->|Retry| C
    E -->|Exceeded| F[Failed]
    G[Next schedule tick] -->|concurrencyPolicy: Forbid| H{Previous running?}
    H -->|Yes| I[Skip]
    H -->|No| B

Frequently Asked Questions

Why did my CronJob miss a run?

Common causes: startingDeadlineSeconds exceeded, concurrencyPolicy: Forbid with still-running job, or suspend: true. Check with kubectl describe cronjob.

CronJob timezone support?

Available since K8s 1.27 (stable). Use spec.timeZone with IANA timezone names like Europe/London, America/New_York. Without it, schedule uses kube-controller-manager’s timezone (usually UTC).

Best Practices

  • Start with the simplest configuration that solves your problem
  • Test in staging before production
  • Use kubectl describe and events for troubleshooting
  • Document team conventions for consistency

Key Takeaways

  • This is fundamental Kubernetes operational knowledge
  • Follow established conventions and recommended labels
  • Monitor and iterate based on real production behavior
  • Automate repetitive tasks to reduce human error
#cronjob #scheduling #cron #automation #kubernetes
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Kubernetes Recipes book cover

Want More Kubernetes Recipes?

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens