title: Advantage of using configmaps for environment variables with Kubernetes/Helm
body: <p>When creating deployments, I am currently trying to find a reason why one should externalize the environment variables for a container into a configmap.
  So instead of defining environment variables with </p>
  
  <pre><code>    env:
      - name: LANGUAGE
        value: "English"
  </code></pre>
  
  <p>in the deployment.yaml use</p>
  
  <pre><code>    env:
      - name: LANGUAGE
        valueFrom:
          configMapKeyRef:
            name: language
            key: LANGUAGE
  </code></pre>
  
  <p>or </p>
  
  <pre><code>      envFrom:
        - configMapRef:
            name: env-configmap
  </code></pre>
  
  <p>with an additional configmap.yaml like so: </p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: env-configmap
  data:
    LANGUAGE: English
  </code></pre>
  
  <p>Of course, when using confidential values, they should be read from a secret, but that does not apply to non-confidential variables. The only advantage I see is that I can reuse these configmaps, but apart from that it only makes the chart more complicated as I now have to ensure that the pods are restarted etc...</p>
  
  <p>So: What are other advantages when using ConfigMaps to read the environment variables?</p>