kuberneteskubernetes-cronjob

Cronjob is not executing at scheduled interval


I have kubernetes cronjob at defined interval. This needs to be run for every 5hours 15mins. But might be issue with cron scheduled.

This is my kubernetes CronJob :


apiVersion: batch/v1
kind: CronJob
metadata:
  name: Cronjob-monitor
  namespace: cronjobs
  labels:
    app: Cronjob-monitor
spec:
  schedule: "15 5 * * *"
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  concurrencyPolicy: Replace
  jobTemplate:
    spec:
      template:
        spec:
          nodeSelector:
            agentpool: streaming
          restartPolicy: OnFailure

This is not executing for every 5hrs 15th min. Can any one guide me on this.


Solution

  • I have observed that you have given cron job schedule syntax as : "15 5 * * *" . This will run everyday 5th hr 15 min but not as per your requirement . So, Seems to be a cron job schedule syntax issue. Can you try by giving this syntax 15 */5 * * 1-7 . As per the below screenshot, this cron job syntax will run for every 5 hr's 15th min from monday to sunday.

    image

    You can use this crontab.guru play tool to check the syntax of the scheduled job according to our requirements. Can you try the above suggested syntax and let me know.