title: Should I use configMap for every environment variable?
body: <p>I am using helm right now. My project is like that:</p>
  
  <p><strong>values.yaml:</strong></p>
  
  <pre><code>environmentVariables:
    KEY1: VALUE1
    KEY2: VALUE2
  </code></pre>
  
  <p><strong>configmap.yaml:</strong></p>
  
  <pre><code>apiVersion: v1
  kind: ConfigMap
  metadata:
    name: {{ template "myproject.fullname" . }}
  data:
  {{- range $k, $v := .Values.environmentVariables }}
    {{ $k }}: {{ $v | quote }}
  {{- end }}
  </code></pre>
  
  <p><strong>deployment.yaml:</strong></p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: {{ template "myproject.fullname" . }}
  spec:
    template:
      spec:
        containers:
          - name: {{ .Chart.Name }}
            image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
            imagePullPolicy: {{ .Values.image.pullPolicy }}
            env:
  {{- range $k, $v := .Values.environmentVariables }}
              - name: {{ $k }}
                valueFrom:
                  configMapKeyRef:
                    name: {{ template "myproject.fullname" $ }}
                    key: {{ $k }}
  {{- end }}
  ...
  </code></pre>
  
  <p>But right now, I'm really confused. Am I really need this configmap? Is there any benefit to use configmap for environment variables?</p>