<p>At the moment my daily Kubernetes CronJob creates job instances with a name with the following pattern:</p>
<pre><code>my-chron-job-28038600-acddef
my-chron-job-28038660-acddef
my-chron-job-28038720-acddef
</code></pre>
<p>I was wondering, if there is an easy way to override this and ensure that the CronJob creates Job following a pattern like the following one, which includes the Job creation/execution date in a human readable format:</p>
<pre><code>my-chron-job-2023-05-01-acddef
my-chron-job-2023-05-02-acddef
my-chron-job-2023-05-03-acddef
</code></pre>

Attila
<p>AFAIK it is not possible. However, you can use <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">jsonpath</a> to combine the pod name with the pod's start time:</p>
<pre><code>kubectl get pods -l job-name -o jsonpath='{range .items[*]}{.metadata.labels.job-name}{&quot;-&quot;}{.status.startTime}{&quot;\n&quot;}{end}'
</code></pre>
<p>Note: the <code>job-name</code> label is automatically populated by k8s.</p>
<p>The output would be then something like:</p>
<pre><code>my-chron-job-28052272-2023-05-11:52:00Z
...
</code></pre>
<p>You can further refine the output (through pipes, <code>awk</code>, <code>sed</code> etc.) to achieve exactly the desired format. I don't know if it'ld be worth the effort though.</p>
