How to change the timezone of containers running in k8s

  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