Kubernetes run cronjob in wrong time

5/13/2019

I have a schedule: schedule: "0 10,14,18 * * *", I'd like to run this job in 10:00 am, 2:00pm, 6:00pm.

Since I located at UTC+8 timezone, this cronjob looks like not run as I expected.

Anyway to add a config for timezone?

-- xring
kubernetes
kubernetes-cronjob

1 Answer

5/13/2019

From Kubernetes documentation:

Note: All CronJob schedule: times are based on the timezone of the master where the job is initiated.

You should be ok if you deploy your master in Hong Kong. GCP does not have a region in China (see here)

You may consider deploying Kubernetes on Aws. Aws has regions in Beijing, China and Ningxia, China (see here)

Or may be on Azure (see here)

With above setup in place, schedule: "0 10,14,18 * * *" should work

-- Rajesh Gupta
Source: StackOverflow