<p>Inside my container I have in my <code>spec.jobTemplate.spec.template.spec</code>:</p>
<pre><code>          containers:
            - name: &quot;run&quot;
              env:
                {{ include &quot;schedule.envVariables&quot; . | nindent 16 }}
                - name: POD_NAME
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.name
                - name: POD_CREATION_TIMESTAMP
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.creationTimestamp
</code></pre>
<p>However I just get the error:</p>
<blockquote>
<p>CronJob.batch &quot;schedule-3eb71b12d3&quot; is invalid: spec.jobTemplate.spec.template.spec.containers[0].env[19]</p>
</blockquote>
<p>When changing to:</p>
<pre><code>- name: POD_CREATION_TIMESTAMP
  value: &quot;&quot;
</code></pre>
<p>I get no errors. Any idea?</p>

maxisme
<p>The reason is that <code>fieldRef</code> doesn't support the use of <code>metadata.creationTimestamp</code>.</p>
<pre class="lang-bash prettyprint-override"><code>$ kubectl explain job.spec.template.spec.containers.env.valueFrom

...
   fieldRef &lt;Object&gt;
     Selects a field of the pod: supports metadata.name, metadata.namespace,
     `metadata.labels['&lt;KEY&gt;']`, `metadata.annotations['&lt;KEY&gt;']`, spec.nodeName,
     spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
...
</code></pre>
