apiVersion: v1
kind: Pod
metadata:
  name: pod-hostpath-timezone
spec:
  volumes:
  #- name: timezone
  #  hostPath:
  #    path: /etc/timezone     #配置时区方法1: 此文件用于影响时区,可选
  #    type: File
  - name: localtime           
    hostPath:
      #path: /etc/localtime   #此文件为软链接所以挂载失败，但不影响时区
      path: /usr/share/zoneinfo/Asia/Shanghai #配置时区方法2: 此文件用于影响时区，必选
      type: File      
  containers:
  - name: c01
    image: registry.cn-beijing.aliyuncs.com/wangxiaochun/nginx:1.20.0
    #command: ["sh","-c","sleep 3600"]
  - name: c02
    image: registry.cn-beijing.aliyuncs.com/wangxiaochun/nginx:1.20.0
    command: ["sh","-c","sleep 3600"]
    volumeMounts:
    #- name: timezone
    #  mountPath: /etc/timezone  #容器此为文件是普通文件，挂载节点目录成功
    - name: localtime
      mountPath: /etc/localtime #容器此为文件是普通文件，挂载节点目录成功
