<p>i am trying to deploy image which has some change to it environment variables, but when i do so i am getting below error </p>

<blockquote>
  <p>The Pod "envar-demo" is invalid: spec: Forbidden: pod updates may not
  change fields other than <code>spec.containers[*].image</code>,
  <code>spec.initContainers[*].image</code>, <code>spec.activeDeadlineSeconds</code> or
  <code>spec.tolerations</code> (only additions to existing tolerations)
  {"Volumes":[{"Name":"default-token-9dgzr","HostPath":null,"EmptyDir":null,"GCEPersistentDisk":null,"AWSElasticBlockStore":null,"GitRepo":null,"Secret":{"SecretName":"default-token-9dgzr","Items":null,"DefaultMode":420,"Optional":null},"NFS":null,"ISCSI":null,"Glusterfs":null,"PersistentVolumeClaim":null,"RBD":null,"Quobyte":null,"FlexVolume":null,"Cinder":null,"CephFS":null,"Flocker":null,"DownwardAPI":null,"FC":null,"AzureFile":null,"ConfigMap":null,"VsphereVolume":null,"AzureDisk":null,"PhotonPersistentDisk":null,"Projected":null,"PortworxVolume":null,"ScaleIO":null,"StorageOS":null}],"InitContainers":null,"Containers":[{"Name":"envar-demo-container","Image":"gcr.io/google-samples/node-hello:1.0","Command":null,"Args":null,"WorkingDir":"","Ports":null,"EnvFrom":null,"Env":[{"Name":"DEMO_GREETING","Value":"Hello
  from the environment</p>
</blockquote>

<p>my yaml.</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: envar-demo
  labels:
    purpose: demonstrate-envars-new
spec:
  containers:
  - name: envar-demo-container
    image: gcr.io/google-samples/node-hello:1.0
    env:
    - name: DEMO_GREETING
      value: "Hello from the environment-change value"
    - name: DEMO_FAREWELL
      value: "Such a sweet sorrow"
</code></pre>

<p>why i am not able to deploy, when there is change to my container environment variables. </p>

<p>my pod is running state, but still i need to change my environment variable, and restart my pod.</p>

<p>actually, you are better off using deployments for this use case.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-hello
  labels:
    app: node-hello
spec:
  replicas: 3
  selector:
    matchLabels:
      app: node-hello
  template:
    metadata:
      labels:
        app: node-hello
    spec:
      containers:
      - name: node-hello
        image: gcr.io/google-samples/node-hello:1.0
        ports:
        - containerPort: 80
        env:
        - name: DEMO_GREETING
          value: "Hello from the environment-change value"
        - name: DEMO_FAREWELL
          value: "Such a sweet sorrow"
</code></pre>

<p>this way you would be able to change environment variables and the pod will get restarted with the new environment variables</p>
