<p>I was wondering if it's possible to refer to image field in Kubernetes deployment yaml file,
as </p>

<pre class="lang-yaml prettyprint-override"><code>    env:
    - name: VERSION
      value:
        valueFrom:
          containerField: spec.image
</code></pre>

<p>Please let me know. Thank you. </p>

<p><code>image</code> value in pod definition cannot be passed as environment variable using <code>fieldRef</code>. </p>

<p>The only <a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#capabilities-of-the-downward-api" rel="nofollow noreferrer">supported values are</a> <code>metadata.name, metadata.namespace, metadata.labels, metadata.annotations, spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs</code> and <code>resource</code> fields (memory, cpu request/limits) and container ephemeral storage limit/request. </p>

<p>As a workaround it can be passed using labels and then passing this label as an environment variable, example:</p>

<pre><code>    env:
    - name: VERSION
      valueFrom:
        fieldRef: 
          fieldPath: metadata.labels['version']
</code></pre>
