<p>I have a cron job on kubernetes that I trigger like so for testing purposes:</p>
<pre><code>kubectl create -f src/cronjob.yaml
kubectl create job --from=cronjob/analysis analysis-test
</code></pre>
<p>This creates a pod with the name <code>analysis-test-&lt;random-string&gt;</code>. I was wondering if it's possible to omit or make the suffix predictable?</p>
<h1>Filtered <code>cronjob.yaml</code></h1>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: analysis
  labels:
    job: analysis
spec:
  schedule: &quot;0 0 * * 0&quot;
  concurrencyPolicy: &quot;Forbid&quot;
  suspend: true
  failedJobsHistoryLimit: 3
  successfulJobsHistoryLimit: 3
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: container-name
              image: myimage
              env:
              - name: ENVIRONMENT
                value: &quot;DEV&quot;
              imagePullPolicy: IfNotPresent
              command: [ &quot;/bin/bash&quot;, &quot;-c&quot;, &quot;--&quot; ]
              args: [ &quot;while true; do sleep 30; done;&quot;]
</code></pre>

<p>As of v1beta1, no you can't, here's the doc regarding cronjob
<a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/</a></p>
<p>Here's an excerpt from the docs:</p>
<blockquote>
<p>When creating the manifest for a CronJob resource, make sure the name you provide is a valid DNS subdomain name. The name must be no longer than 52 characters. This is because the CronJob controller will automatically append 11 characters to the job name provided and there is a constraint that the maximum length of a Job name is no more than 63 characters.</p>
</blockquote>
<p>Also here's a reference page to CronJob v1beta1 spec to view the available options config:
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#cronjobspec-v1beta1-batch" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#cronjobspec-v1beta1-batch</a></p>
<hr />
<p>Digging through the source code a little bit, you can see how the CronJob controller create the Job Resource
<a href="https://github.com/kubernetes/kubernetes/blob/v1.20.1/pkg/controller/cronjob/cronjob_controller.go#L327" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/v1.20.1/pkg/controller/cronjob/cronjob_controller.go#L327</a>
<a href="https://github.com/kubernetes/kubernetes/blob/v1.20.1/pkg/controller/cronjob/utils.go#L219" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/v1.20.1/pkg/controller/cronjob/utils.go#L219</a></p>
