Kubernetes CronJob Generator

Generate Kubernetes CronJob YAML configurations with validated cron expressions. Copy-ready YAML for your K8s deployments.

Kubernetes CronJob Schedule
0Minute
9Hour
*Day
*Month
1-5Weekday

ℹ️ This only runs on weekdays (Monday-Friday)

Copy-Ready Snippets

Kubernetes CronJob

Deploy this CronJob to your Kubernetes cluster

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-scheduled-job
spec:
  schedule: "0 9 * * 1-5"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: my-scheduled-job
            image: your-image:latest
            command:
            - /bin/sh
            - -c
            - /path/to/your/script.sh
          restartPolicy: OnFailure
yaml

Kubernetes CronJob Format

Kubernetes CronJobs use standard 5-field cron expressions in the schedule field of the CronJob spec. The format is: minute hour day-of-month month day-of-week

Kubernetes CronJob YAML Structure

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-cronjob
spec:
  schedule: "0 9 * * 1-5"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: my-container
            image: my-image:latest
          restartPolicy: OnFailure

Common Kubernetes CronJob Examples

  • 0 9 * * 1-5 - Every weekday at 9 AM
  • 0 0 * * * - Every day at midnight
  • */5 * * * * - Every 5 minutes
  • 0 0 1 * * - First day of every month

Best Practices

  • Use descriptive names for your CronJobs
  • Set appropriate resource limits
  • Configure restart policies
  • Use timezone-aware scheduling when needed
  • Monitor CronJob execution history