k8s中pod默认时区不是中国的,挂载一个时区可以解决
vi pod.yaml
apiVersion: v1
kind: Pod
metadata:name: counter
spec:containers:- name: countimage: 172.16.80.140/busybox/busybox:latestimagePullPolicy: IfNotPresentargs: [/bin/sh,-c,'i=0;while true;do echo "$i: $(date)"; i=$((i+1));sleep 1;done']volumeMounts:- name: localtimemountPath: /etc/localtimevolumes:- name: localtimehostPath:path: /usr/share/zoneinfo/Asia/Shanghai
有了volumes和volumenMounts,时区就正常了
通过kinaba可看到pod日志