<p>I have a configmap.yaml file as below :</p>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: abc
  namespace: monitoring
  labels:
    app: abc
    version: 0.17.0
data:
  application.yml: |-
    myjava:
      security:
        enabled: true
    abc:
      server:
        access-log: 
          enabled: ${myvar}. ## this is not working
</code></pre>
<p>&quot;myvar&quot; value is available in pod as shell environment variable from secretkeyref field in deployment file.</p>
<p>Now I want to replace myvar shell environment variable in configmap above i.e before application.yml file is available in pod it should have replaced myvar value. which is not working i tried ${myvar} and $(myvar) and &quot;#{ENV['myvar']}&quot;</p>
<p>Is that possible in kubernetes configmap to reference with in data section pod's environment variable if yes how or should i need to write a script to replace with sed -i application.yml etc.</p>

ankur-AJ
<blockquote>
<p>Is that possible in kubernetes configmap to reference with in data section pod's environment variable</p>
</blockquote>
<p>That's not possible. A <code>ConfigMap</code> is not associated with a particular pod, so there's no way to perform the sort of variable substitution you're asking about. You would need to implement this logic inside your containers (fetch the <code>ConfigMap</code>, perform variable substitution yourself, then consume the data).</p>
