Kubernetes cron job running 1 minutes earlier

2/3/2020

I have kubernetes cluster which has installed on "EST" time zone, if i see the job describe which say ran at "Sun, 02 Feb 2020 19:01:09 -0500" and my cron expression says schedule: "1 0 * * *" " ie every day at 12:01 minutes and i see below Job also started at the same time but in EST time zone

Parallelism:              1
Completions:              1
Start Time:               Sun, 02 Feb 2020 19:01:09 -0500
Completed At:             Sun, 02 Feb 2020 19:01:24 -0500
Duration:                 15s
Active Deadline Seconds:  30s
Pods Statuses:            0 Running / 1 Succeeded / 0 Failed

But when i see the logs of Pod ie showing its ran 1 minutes prior to the schedule

 2020-02-02 23:59:51,154 INFO TestMetrics - Daily Job : TestMetrics  Daily Job Script Started - V1.0.0

I want below clarification?

  1. Is POD always run in UTC Timezone? if Master and worker node Timezone is configured as EST
  2. Why Job ran 1 minutes earlier then the Scheduled?

Linux version :

3.10.0-514.el7.x86_64

Kubectl version

Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T10:39:04Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.12", GitCommit:"a8b52209ee172232b6db7a6e0ce2adc77458829f", GitTreeState:"clean", BuildDate:"2019-10-15T12:04:30Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"}
-- Pandit Biradar
kubernetes
kubernetes-cronjob
kubernetes-pod
linux
timezone

2 Answers

3/15/2020
-- Pandit Biradar
Source: StackOverflow

2/4/2020
  1. Is POD always run in UTC Timezone? if Master and worker node Timezone is configured as EST

All CronJob schedule: times are based on the timezone of the master where the job is initiated. More details can be found in the official documentation.

  1. Why Job ran 1 minutes earlier then the Scheduled?

The cron expression that you have showed us is wrong. It should be:

  • 0 1 12 ? * * * if the job should trigger 1 min after midday, or

  • 0 1 0 ? * * * if the job should trigger 1 min after midnight

I hope it helps.

-- OhHiMark
Source: StackOverflow