Issue
I have a kubernetes cronjob object defined as follows:
apiVersion: batch/v1
kind: CronJob
metadata:
name: cloud-backup
namespace: test-backup
spec:
schedule: "0 */50 * * *"
.....
However, it's running every single day at 8pm which makes no sense to me. Isn't this cron format configured to run once every 50 hours? I'm using this exact cron schedule in a concourse pipeline at it runs when expected there so not sure what I'm missing.
Thanks!
Solution
A cron expression allows certain values per field. For the hour field the values 0-23 are allowed. (See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax )
If you want to achieve something that does not run in an interval that can be expressed using the cron expressions you might want to have a cronjob that runs once per hour and uses a configmap to store the execution state and schedule a regular job programmatically.
Answered By - Thomas Answer Checked By - Pedro (WPSolving Volunteer)