<p>I have a weird issue with envFrom:</p>
<pre><code> - name: template-api
 envFrom:
   - secretRef:
     name: common-secrets
   - secretRef:
     name: template-api
</code></pre>
<p>in common-secrets I have variables like this:</p>
<pre><code>MAILHOST=smtp.gmail.com
MAILPORT=587
</code></pre>
<p>And template-api is like:</p>
<pre><code>MAIL_HOST=$MAILHOST
MAIL_PORT=$MAILPORT
</code></pre>
<p>This is like that, because pods have different variables names for same info.
But when the container is running the variables are replaced with literal $VAR instead of var value.
Maybe Im using the wrong solution for this. Did somebody face the same issue?</p>

Francisco Rebolledo
<p>Kubernetes won't update it that way, if you are running that approach with any code or script it will work inside the code. like <code>process.env($MAILHOST)</code></p>
<p>Whatever you have mentioned in secret it will get injected into the <strong>OS</strong> <strong>environment</strong> now if the same values are there it will get <strong>overwritten</strong>.</p>
<p>Kubernetes inject the secret based on the <strong>YAML</strong> configuration either to the <strong>file system</strong> or either inside the <strong>OS</strong>.</p>
<p>Kubernetes simply inject the values into the <strong>POD</strong> as set in secret. it won't check <strong>whether</strong> anything is already set in the environment and replaces it with values.</p>
