How to change the timezone of containers running in k8s

Shawn.L
1 min readMar 6, 2020
  1. Change the timezone in the image(below commands needs to be modified according to the Linux distribution)
RUN rm -rf /etc/localtime
RUN ln -s /usr/share/zoneinfo/Asia/Singapore /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata

2. Change the timezone via k8s mount hostPath

spec:containers:- name: nginximage: nginxports:- containerPort: 80name: nginxvolumeMounts:- name: tz-configmountPath: /etc/localtimevolumes:- name: tz-confighostPath:path:  /usr/share/zoneinfo/Asia/Singapore

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response