Kuberntes timezone

Pod

Use node time zone

部署应用时,单独读取主机的“/etc/localtime”文件,即创建pod时同步时区,无需修改镜像,但是每个应用都要单独设置。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: myweb
spec:
replicas: 1
template:
metadata:
labels:
app: myweb
spec:
containers:
- name: myweb
image:
volumeMounts:
- name: HostTime
mountPath: /etc/localtime
volumes:
- name: HostTime
hostPath:
path: /etc/localtime

Use appointed timez one

Linux:timezone info /usr/share/zoneinfo

如果使用GMT+0,则需要使用/usr/share/zoneinfo/GMT+0

Modify:ln -s /usr/share/zoneinfo/US/Pacific localtime


Reference