kubernetes timezone in POD with command and argument

前端 未结 4 1857
醉酒成梦
醉酒成梦 2021-01-02 07:30

I want to change timezone with command. I know applying hostpath.

Could you know how to apply command ?

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

4条回答
  •  暖寄归人
    2021-01-02 08:10

    Setting TZ environment variable as below works fine for me on GCP Kubernetes.

    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: demo
    spec:
      replicas: 1
      selector:
        matchLabels:
            app: myapp
      template:
        metadata:
          labels:
            app: myapp
        spec:
          containers:
          - name: demo
            image: gcr.io/project/image:master
            imagePullPolicy: Always
            env:
                - name: TZ
                  value: Europe/Warsaw
          dnsPolicy: ClusterFirst
          restartPolicy: Always
          terminationGracePeriodSeconds: 0
    

提交回复
热议问题