BackendBench
Coffee

Home โ€บ Cron errors โ€บ Kubernetes

Kubernetes ยท error

Kubernetes CronJob does not support seconds

The CronJob "my-job" is invalid: spec.schedule: Invalid value: "*/30 * * * * *": expected exactly 5 fields, found 6

Why this happens

CronJob schedules use five fields, so the finest interval is one minute.

Wrong and right

wrong
*/30 * * * * *

Our parser says: Kubernetes CronJob needs 5 fields, but you gave 6

fixed
* * * * *

Every minute. First runs after 1 Jan 2027 (UTC): Fri 01 Jan, 00:01, Fri 01 Jan, 00:02, Fri 01 Jan, 00:03, Fri 01 Jan, 00:04, Fri 01 Jan, 00:05

How to fix it

  1. Use a five-field schedule such as * * * * *.
  2. For sub-minute work, run a long-lived Deployment with its own timer.
  3. Do not paste Spring or Quartz expressions into a CronJob.

The Kubernetes format at a glance

Fields in order: minute (0-59), hour (0-23), day-of-month (1-31), month (1-12), day-of-week (0-7, 0 and 7 = Sunday).

Set spec.timeZone (Kubernetes 1.27+) to a name like Asia/Kolkata. Without it the schedule follows the controller's time zone, usually UTC.

The fixed schedule in other systems

If you are moving this schedule to another scheduler, these are the equivalents of * * * * *:

SystemExpression
Quartz0 * * * * ?
Spring0 * * * * *
Crontab* * * * *
AWS EventBridge* * * * ? *
Jenkins* * * * *
GitHub Actions* * * * *
node-cron* * * * *
Apache Airflow* * * * *
Azure Functions0 * * * * *
Google Cloud Scheduler* * * * *

Try it yourself

The tester below starts with the fixed expression. Change it and watch the schedule update.

Your week at a glance
fewer more runs

Upcoming runs

#LocalUTCFrom now

Copy-ready code

Frequently asked questions

Can I run a CronJob every 30 seconds?

Not directly. Either run two CronJobs with a sleep, or use a Deployment that loops.

More Kubernetes fixes

See the full Kubernetes cron builder or convert between formats.

More tools you might need