【发布时间】:2021-08-26 06:45:44
【问题描述】:
我正在尝试按照kubernetes timezone in POD with command and argument 将我的 pod 时间更新到亚洲/加尔各答区域。但是,时间仍然保持相同的 UTC 时间。只有时区从 UTC 更新到亚洲。
我能够使用如下的卷安装来修复它。创建配置映射并应用部署 yaml。
kubectl create configmap tz --from-file=/usr/share/zoneinfo/Asia/Kolkata -n <required namespace>
为什么环境变量方法不起作用?如果我们使用卷挂载时间,是否会从一台主机到另一台主机进行 pod 逐出,并且是否会影响 pod 逐出后的卷挂载时间?
EV 部署 YAML 下面不更新时间
apiVersion: apps/v1
kind: Deployment
metadata:
name: connector
labels:
app: connector
namespace: clients
spec:
replicas: 1
selector:
matchLabels:
app: connector
template:
metadata:
labels:
app: connector
spec:
containers:
- image: connector
name: connector
resources:
requests:
memory: "32Mi" # "64M"
cpu: "250m"
limits:
memory: "64Mi" # "128M"
cpu: "500m"
ports:
- containerPort: 3307
protocol: TCP
env:
- name: TZ
value: Asia/Kolkata
volumeMounts:
- name: connector-rd
mountPath: /home/mongobi/mongosqld.conf
subPath: mongosqld.conf
volumes:
- name: connector-rd
configMap:
name: connector-rd
items:
- key: mongod.conf
Volume Mount yaml 如下。
apiVersion: apps/v1
kind: Deployment
metadata:
name: connector
labels:
app: connector
namespace: clients
spec:
replicas: 1
selector:
matchLabels:
app: connector
template:
metadata:
labels:
app: connector
spec:
containers:
- image: connector
name: connector
resources:
requests:
memory: "32Mi" # "64M"
cpu: "250m"
limits:
memory: "64Mi" # "128M"
cpu: "500m"
ports:
- containerPort: 3307
protocol: TCP
volumeMounts:
- name: tz-config
mountPath: /etc/localtime
- name: connector-rd
mountPath: /home/mongobi/mongosqld.conf
subPath: mongosqld.conf
volumes:
- name: connector-rd
configMap:
name: connector-rd
items:
- key: mongod.conf
path: mongosqld.conf
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/Asia/Kolkata
【问题讨论】:
-
它只发生在加尔各答?根据this answer,Europe/Warsaw 在同一个例子中工作得很好
标签: kubernetes timezone mongodb-biconnector