By default GKE Cluster with container image is using UTC+0 timezone, to change the timezone we need to use k8tz installed to the cluster. You can check the details of k8tz on their github page here https://github.com/k8tz/k8tz
This example use GKE Private cluster with Access control plane using its external IP address enable.
First open Cloud Shell.
Check cloud shell external IP address using this command
Add cloud shell external IP to the cluster.
Connect to the cluster.
Install k8tz to the cluster using helm charts by running the following command:
don’t forget to change the timezone with your timezone.
Inject k8tz to the deployments or statefulsets using the following command:
-
For statefulsets
-
For deployments
After that you can verify the timezone by run date command inside the pods using kubectl exec
.