k8s pod同步时区
示例apiVersion: v1kind: Podmetadata:name: counterspec:containers:- name: countimage: busyboxargs: [/bin/sh, -c,'i=0; while true; do echo "hello world: $i: $(date)"; i=$((i+1)); sleep 10; done']volumeMou
·
示例
apiVersion: v1
kind: Pod
metadata:
name: counter
spec:
containers:
- name: count
image: busybox
args: [/bin/sh, -c,
'i=0; while true; do echo "hello world: $i: $(date)"; i=$((i+1)); sleep 10; done']
volumeMounts:
- mountPath: /etc/localtime
name: timezone
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
加上后面的volume即可
volumeMounts:
- mountPath: /etc/localtime
name: timezone
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
其中hostPath
是宿主机的本地路径,
还有其它方法就不说了,这个最保险。
查看pod的时间
kubectl exec pod/counter date
更多推荐
已为社区贡献16条内容
所有评论(0)