title: Is there any way to use configMaps in K8s with nested values to be used as environment variable in the pod?
body: <p>I have the sample cm.yml for configMap with nested json like data.</p>
  
  <pre><code>kind: ConfigMap
  metadata:
   name: sample-cm
  data:
   spring: |-
    rabbitmq: |-
     host: "sample.com"
    datasource: |-
     url: "jdbc:postgresql:sampleDb"
  </code></pre>
  
  <p>I have to set environment variables, spring-rabbitmq-host=sample.com and spring-datasource-url= jdbc:postgresql:sampleDb in the following pod.</p>
  
  <pre><code>kind: Pod
  metadata:
   name: pod-sample
  spec:
   containers:
    - name: test-container
      image: gcr.io/google_containers/busybox
      command: [ "/bin/sh", "-c", "env" ]
      env:
       - name: sping-rabbitmq-host
         valueFrom:
          configMapKeyRef:
           name: sample-cm    
           key: &lt;what should i specify here?&gt;
       - name: spring-datasource-url
         valueFrom:
          configMapKeyRef:
           name: sample-cm
           key: &lt;what should i specify here?&gt;
  </code></pre>