<p>I would like to run a pod on one of my IoT devices.
Each one of those devices contains an environment variable I want this pod to use.
Is there any way to inject this env variable into the pod using build-in templating of <code>helm</code>/<code>kubectl</code>?
I was trying the following on my <code>deployment.yaml</code> file:</p>
<pre><code>env: 
  - name: XXX
    value: $ENV_FROM_HOST
</code></pre>
<p>but when executing the pod and trying the get <code>XXX</code> value, I get the string <code>$ENV_FROM_HOST</code> instead of its value from the host:</p>
<pre><code>$ echo $XXX
$ENV_FROM_HOST
</code></pre>
<p>Thanks.</p>

Livne Rosenblum
<p>It's not possible to directly pass the host's env vars to the pods. I often do that by creating a ConfigMap.</p>
<ol>
<li><p>Create a ConfigMap with <code>from-lireral</code> option:</p>
<pre><code>kubectl create configmap testcm --from-literal=hostname=$HOSTNAME
</code></pre>
</li>
<li><p>Refer to that in the Pod's manifest:</p>
<pre class="lang-yaml prettyprint-override"><code>- name: TEST
  valueFrom:
    configMapKeyRef:
      name: testcm
      key: hostname
</code></pre>
</li>
</ol>
<p>This will inject the host's $HOSTNAME into the Pod's $TEST.</p>
<p>If it's sensitive information, you can use Secrets instead of using ConfigMap.</p>
