示例
代码语言:javascript复制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即可
代码语言:javascript复制 volumeMounts:
- mountPath: /etc/localtime
name: timezone
volumes:
- name: timezone
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
其中hostPath
是宿主机的本地路径,
还有其它方法就不说了,这个最保险。
查看pod的时间
代码语言:javascript复制kubectl exec pod/counter date
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/100334.html原文链接: