Kubernetes CronJob Not Starting on Schedule with Time Zone guide in 1.26
I'm working through a tutorial and I'm writing unit tests and I'm updating my dependencies and I'm working with an scenario where my Kubernetes CronJob is not starting at the expected times... I've defined a CronJob to run every day at 3 AM UTC, but it seems to be running at different times. Hereβs the CronJob definition I've used: ```yaml apiVersion: batch/v1beta1 kind: CronJob metadata: name: my-cronjob spec: schedule: "0 3 * * *" jobTemplate: spec: template: spec: containers: - name: my-job image: my-image:latest args: - /bin/sh - -c - echo Hello, World! restartPolicy: OnFailure ``` I suspected a time zone scenario, as I'm running this cluster in Google Kubernetes Engine (GKE) and Iβm in a different timezone (PST). I've checked the `kubectl get cronjob my-cronjob -o yaml` output and the schedule looks correct. However, the CronJob does not seem to align with my local time. I also tried adding the annotation `kubectl.kubernetes.io/cronjob-type: "batch"` but it didn't help. When I checked the logs with `kubectl logs job/my-cronjob-<job-id>`, I saw that it ran at unexpected times: ``` **Job logs**: 2023-10-01 03:00:00 UTC - Job started! 2023-10-01 14:00:00 UTC - Job started! ``` It seems to be running around 14:00 UTC instead of 3 AM. Iβve also verified that the timezone of the nodes is set to UTC. My assumption is that the CronJob is interpreting the schedule in a different timezone. How can I configure my CronJob to run at 3 AM PST instead of UTC, or how can I get it to use the correct timezone? Any recommendations would be appreciated! I'm on Windows 10 using the latest version of Yaml. I'm open to any suggestions. I recently upgraded to Yaml stable. Thanks, I really appreciate it!