kubectl exec -it podName -n namespace /bin/sh.
When I entered the container and ran the
date command, I found that the time zone is not UTC time zone, so the company logging system cannot collect logs and needs to change to UTC+8.
You need to change the Dockerfile to change the timezone when you build the image.
My base image is alpine and I can use the above settings.
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories means use Ali’s mirror service, which can speed up the installation of tzdata, otherwise it will be very slow because of the network limitation in China.
3. Other systems
Just set the environment variables directly, tzdata is installed by default.