云容器引擎 CCE-时区同步

时间:2023-11-01 16:25:54

时区同步

创建工作负载时,支持设置容器使用节点相同的时区。您可以在创建工作负载时打开时区同步配置。

时区同步功能依赖容器中挂载的本地磁盘(HostPath),如下所示,开启时区同步后,Pod中会通过HostPath方式,将节点的“/etc/localtime”挂载到容器的“/etc/localtime”,从而使得节点和容器使用相同的时区配置文件。

kind: DeploymentapiVersion: apps/v1metadata:  name: test  namespace: defaultspec:  replicas: 2  selector:    matchLabels:      app: test  template:    metadata:      labels:        app: test    spec:      volumes:        - name: vol-162979628557461404          hostPath:            path: /etc/localtime            type: ''      containers:        - name: container-0          image: 'nginx:alpine'          volumeMounts:            - name: vol-162979628557461404              readOnly: true              mountPath: /etc/localtime          imagePullPolicy: IfNotPresent      imagePullSecrets:        - name: default-secret
support.huaweicloud.com/usermanual-cce/cce_10_0354.html