Cron Atlas

Kubernetes error Day or month written as 0

beginning of range (0) below minimum (1): 0

spec.schedule: Invalid value: "0 0 0 * *": beginning of range (0) below minimum (1): 0

Message produced by running the expression through robfig/cron v3.0.1, the parser and version Kubernetes validates .spec.schedule with.

What it means

Days of the month and months are numbered from 1. A 0 in either field is below the minimum. The message doesn’t name the field, so look for a 0 in the third or fourth position, including at the start of a step like 0/2.

Rejected expressions and their fixes

Each expression opens in the tester. The message under a rejected one is what robfig/cron v3.0.1 printed for it.

  1. Rejected0 0 0 * *beginning of range (0) below minimum (1): 0
    Use
    0 0 1 * *At 00:00, on the 1st of the month.

    Midnight on the 1st of the month.

  2. Rejected0 0 1 0 *beginning of range (0) below minimum (1): 0
    Use
    0 0 1 1 *At 00:00, on the 1st of the month, in January.

    Midnight on 1 January. JAN works too.

  3. Rejected0 0 0/2 * *beginning of range (0) below minimum (1): 0/2
    Use
    0 0 */2 * *At 00:00, every 2 days of the month, from the 1st.

    Every other day of the month: the 1st, 3rd, 5th and so on.

Questions

Why is 0 allowed in the hour but not the day?
Minutes and hours count from zero, but days of the month and months are numbered from 1. Day of week also starts at 0, for Sunday.
Does */2 in day of month mean every 48 hours?
No. It matches the odd-numbered days, so a 31-day month runs on the 31st and again on the 1st.

Other Kubernetes errors

Reference