kubernetes timezone in POD with command and argument

前端 未结 4 1851
醉酒成梦
醉酒成梦 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:20

    In a deployment, you can do it by creating a volumeMounts in /etc/localtime and setting its values. Here is an example I have for a mariadb:

    apiVersion: apps/v1beta1
    kind: Deployment
    metadata:
      name: mariadb
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            app: mariadb
        spec:
          containers:
            - name: mariadb
              image: mariadb
              ports:
                - containerPort: 3306
                  name: mariadb
              env:
                - name: MYSQL_ROOT_PASSWORD
                  value: password
              volumeMounts:
              - name: tz-config
                mountPath: /etc/localtime
          volumes:
          - name: tz-config
            hostPath:
               path: /usr/share/zoneinfo/Europe/Madrid 
    

提交回复
热议问题