K8S容器时区问题解决

方法一

在制作容器镜像时候,将时区问题解决

RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

方法二

采用hostpath方式将主机时区挂载至容器内部
          volumeMounts:
            - mountPath: /etc/localtime
              name: time_name
      volumes:
        - hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
            type: ''
          name: time_name

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注