title: Kubernetes ConfigMap: import from file as many values instead of as one?
body: <p>Creating a new ConfigMap from a file:<br>
  <code>kubernetes create configmap foo --from-file=foo</code></p>
  
  <p>This is how the ConfigMap looks internally:
  <code>kubernetes get configmaps foo -o yaml</code></p>
  
  <pre><code>apiVersion: v1
  data:
    foo: |
      VAR1=value1
      VAR2=value2
  </code></pre>
  
  <p>Then, I use this ConfigMap to create a set of environment variables in the container:</p>
  
  <pre><code>apiVersion: v1
  kind: Pod
  metadata:
    labels:
      name: app
    name: app
  spec:
    containers:
      - name: app-server
        image: app:latest
        ports:
          - containerPort: 3000
        envFrom:
        - configMapRef:
            name: foo
        command: ["/bin/bash", "-c", "printenv"]
  </code></pre>
  
  <p>When the container command runs, I see the following output for <code>printenv</code>:</p>
  
  <pre><code>foo=VAR1=value1
  VAR2=value2
  </code></pre>
  
  <p>So, an <code>echo $foo</code> command in the pod returns:<br>
  <code>VAR1=value1 VAR2=value2</code></p>
  
  <p>According to the documentation for ConfigMap with <code>--from-file</code>, this is expected behaviour.</p>
  
  <p>What would be a creative way (and the proper place) to somehow get the values of this file available to the pod as individual env variables <code>VAR1</code>, <code>VAR2</code>, <code>VAR3</code>, etc. ?</p>