<p>I'm trying to use <code>extraEnv</code> property in order to add additional environment variables to set in the pod using helm charts.</p>

<p>I have a <code>values.yaml</code> file that includes: </p>

<pre><code>controller:
  service:
      loadBalancerIP:
  extraEnvs:
     - name: ev1
       value: 
     - name: ev2
       value
</code></pre>

<p>first I've set the loadBalancerIP the following way:</p>

<p><code>helm template path/charts/ingress --set nginx-ingress.controller.service.loadBalancerIP=1.1.1.1 --output-dir .</code></p>

<p>In order to set <code>extraEnvs</code> values I've tried to use the same logic by doing:  </p>

<p><code>helm template path/charts/ingress --set nginx-ingress.controller.service.loadBalancerIP=1.1.1.1 --set nginx-ingress.controller.extraEnvs[0].value=valueEnv1--set nginx.controller.extraEnvs[1].value=valueEnv2--output-dir .</code></p>

<p>But it doesn't work. I looked for the right way to set those variables but couldn't find anything.</p>

MagenB
<p>Helm <code>--set</code> has some <a href="https://helm.sh/docs/using_helm/#the-format-and-limitations-of-set" rel="nofollow noreferrer">limitations</a>.</p>

<p>Your best option is to avoid using the <code>--set</code>, and use the <code>--values</code> flag with your <code>values.yaml</code> file instead:</p>

<pre><code>helm template path/charts/ingress \
--values=values.yaml
</code></pre>

<hr>

<p>If you want to use <code>--set</code> anyway, the equivalent command should have this notation:</p>

<pre><code>helm template path/charts/ingress \
--set=controller.service.loadBalancerIP=1.1.1.1 \
--set=controller.extraEnvs[0].name=ev1,controller.extraEnvs[0].value=valueEnv1 \
--set=controller.extraEnvs[1].name=ev2,controller.extraEnvs[1].value=valueEnv2 \
--output-dir .
</code></pre>
