<p>Related to <a href="https://stackoverflow.com/q/66288565/3288890">Duplicated env variable names in pod definition, what is the precedence rule to determine the final value?</a></p>
<p>I have a deployment spec with a repeated env name, see below:</p>
<pre><code>containers:
  - name: c1
  ...
    env:
      - name: DUP1
        value: hello1
      - name: DUP1
        value: hello2
</code></pre>
<p>Can I expect the second DUP1 key to always be the one set on the pod? e.g. echo $DUP1 == &quot;hello2&quot;. It seems to be the case but I can't find validation about it</p>

Fran
<p>If the order maintains like this, it will always be set as <code>hello2</code></p>
<blockquote>
<p>Note: Environment variables may reference each other, <strong>however ordering is important</strong>. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.</p>
</blockquote>
<p>so if the order changes for the value like this</p>
<pre><code>            - name: DUP1
              value: hello2
            - name: DUP1
              value: hello1
</code></pre>
<p>it will be set as <code>hello1</code></p>
<p><a href="https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/" rel="nofollow noreferrer">inject-environment-variable-container</a></p>
