<p>I have a kubectl config map like below.</p>
<pre><code>apiVersion: v1
data:
  server.properties: |+
    server.hostname=test.com

kind: ConfigMap
metadata:
  name: my-config
</code></pre>
<p>And I tried to read this config inside a container.</p>
<pre><code>containers:
        - name: testserver
          env:
            - name: server.hostname
              valueFrom:
                configMapKeyRef:
                  name: my-config
                  key: server.properties.server.hostname
</code></pre>
<p>However, these configs are not passing to the container properly. Do I need do any changes to my configs?</p>

prime
<p>What you have in there isn't the right key. ConfigMaps are strictly 1 level of k/v pairs. The <code>|+</code> syntax is YAML for a multiline string but the fact the data inside that is also YAML is not something the system knows. As far as Kubernetes is concerned you have one key there, <code>server.properties</code>, with a string value that is opaque.</p>
