When running containers in Openshift (RedHat Implementation of Kubernetes), by default, it is using the timezone which is set in base container image but what if we want to run the image in different timezone ?
We can make that happen by tweaking few parameters, we will see the same in this post, please follow for details -
Scenario:
Let's assume, the base image is set for GMT (London) timezone, and you have to run it in EST timezone (GMT - 5).
Current Timezone in Image:
HowTo:
There is a very simple way to achieve it, simply set an environment variable for your openshift object (deployment config or statefulset), this sets TZ in any containers to the timezone specified.
oc set env OCP_OBJECT\NAME TZ=Timezone
# EST Timezone = America/Toronto
oc set env dc\d01 TZ=America/Toronto
oc set env sts\q03 TZ=America/Toronto
As soon as this command will be executed, your container will be redeployed with the new environment variable.
Timezone after setting up the TZ env variable:
Voila !! Now, your image is running in EST/EDT timezone, you can use this variable to set any timezone in which you want to run your container.
Hoping, you like the post, meet you soon with new post.. till then...Happy Learning !!
Facebook Page Facebook Group Twitter Feed Telegram Group
No comments:
Post a Comment