<p>I am trying to modify the config file of a pod to use local time, but it <strong>show invalid</strong> when saving. Do you know what's wrong ?</p>

<p>In volumeMounts section: I added below lines:</p>

<pre><code>- mountPath: /etc/localtime
      name: tz-config 
</code></pre>

<p>In volumes setion: I added below lines:</p>

<pre><code>- name: tz-config
        hostPath:
          path: /usr/share/zoneinfo/Asia/Ho_Chi_Minh
</code></pre>

<p>Here is my yaml file:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  .....
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: default-token-jgznd
      readOnly: true  
    - mountPath: /etc/localtime
      name: tz-config            
  dnsPolicy: ClusterFirst
  .....
  volumes:
  - name: default-token-jgznd
    secret:
      defaultMode: 420
      secretName: default-token-jgznd
  - name: tz-config
    hostPath:
      path: /usr/share/zoneinfo/Asia/Ho_Chi_Minh   
</code></pre>

<p><strong>UPDATE:</strong> Below are error detail</p>

<pre><code># pods "hello-75fdf45c64-w7xm8" was not valid:
# * spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, `spec.initContainers[*].image`, `spec.activeDeadlineSeconds` or `spec.tolerations` (only additions to existing tolerations)
#   core.PodSpec{
#       Volumes: []core.Volume{
#               {Name: "default-token-wcf8m", VolumeSource: core.VolumeSource{Secret: &amp;core.SecretVolumeSource{SecretName: "default-token-wcf8m", DefaultMode: &amp;420}}},
# -             {
# -                     Name: "tz-config",
# -                     VolumeSource: core.VolumeSource{
# -                             HostPath: &amp;core.HostPathVolumeSource{Path: "/usr/share/zoneinfo/Asia/Ho_Chi_Minh", Type: &amp;""},
# -                     },
# -             },
#       },
#       InitContainers: nil,
</code></pre>

<p>I resolved my problem by adding mountPath to the file deployment yaml as below. Many thanks @Shawlz for help:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2020-02-14T15:59:50Z"
  generation: 1
  labels:
    run: hello
  name: hello
  namespace: default
  resourceVersion: "523908"
  selfLink: /apis/apps/v1/namespaces/default/deployments/hello
  uid: 43196302-0176-4ce2-9d10-c8fefcc6c316
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      run: hello
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        run: hello
    spec:
      containers:
      - image: hello-microservice
        imagePullPolicy: Never
        name: hello
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
          - name: tz-config
            mountPath: /etc/localtime
      volumes:
        - name: tz-config
          hostPath:
            path: /usr/share/zoneinfo/Asia/Ho_Chi_Minh
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
</code></pre>
