<p>My Dockerfile contains default environment variables for development and testing scenarios:</p>

<pre><code>ENV mysql_host=mysql \
    mysql_user=app \
    mysql_password=password \
</code></pre>

<p>and my k8s yaml contains an env directive: </p>

<pre><code>spec:
  containers:
    env:
      - name: "mysql_password"
        value: "someotherpassword"
        name: "mysql_host"
        value: "someotherhost"
        name: "mysql_user"
        value: "someotheruser"
</code></pre>

<p>but when I exec into my running container with </p>

<pre><code>kubctl exec -it service -- /bin/bash
</code></pre>

<p>I'm still seeing "password" as mysql_password .</p>

<p>edit: added more from the k8s yaml for completeness.</p>

<p>you need to declare all the variables in the the correct yaml format
so in this exmaple  mysql_password will override the variable but mysql_password2 will not override and will only be inserted if its not declared already :</p>
<pre><code>spec:
  containers:
    env:
      - name: mysql_password     
        value: &quot;someotherpassword&quot;
      - name: mysql_password2
        value: &quot;password&quot; 
      - name: override_password
        value: password3 
</code></pre>
<p>meaning if it started with a &quot;-&quot; it will override . otherwise it will insert the variable to the container</p>
