gpt4 book ai didi

带有命令和参数的 POD 中的 kubernetes 时区

转载 作者:行者123 更新时间:2023-12-04 22:26:56 25 4
gpt4 key购买 nike

我想用命令更改时区。
我知道应用主机路径。

你能知道如何应用命令吗?

ln -snf/user/share/zoneinfor/$TZ/etc/localtime

它在容器内运行良好。
但我不知道在 yaml 文件中使用命令和参数。

最佳答案

您可以更改 timezone通过使用特定的时区配置和 hostPath 卷来设置特定的时区。您的 yaml 文件将类似于:

apiVersion: v1
kind: Pod
metadata:
name: busybox-sleep
spec:
containers:
- name: busybox
image: busybox
args:
- sleep
- "1000000"
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
volumes:
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Europe/Prague
type: File

如果您希望它跨所有 pod,部署,您需要将 volume 和 volumeMounts 添加到所有部署文件并更改 path值在 hostPath部分到您要设置的时区。

关于带有命令和参数的 POD 中的 kubernetes 时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55089265/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com