<p>Kubernetes is a very sophisticated tool, but some of us are a bit crude, and so we get in trouble.</p>
<p>I'm trying to run a simple kubernetes job on a pod in my cluster, and in the kubernetes yaml config file i define the name of the pod under metadata like</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: my-job
</code></pre>
<p>Then when I create this job I see that the name of the pod is not really my-job.
It's:</p>
<pre><code>my-job-'randomstuff' 
</code></pre>
<p>I understand this is very cool for replicasets and whatnots, but I need my pod to be named what I tell it to be named, because I use that name in callbacks function further down the road..</p>
<p>It seems to me to be strange, that I can't have complete control over what I want to call my pod when I create it.</p>
<p>I tell myself that it must be possible, but I've googledfrenzied for an hour..</p>
<p>Thank you very much for any ideas :)</p>

1233023
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">Jobs</a> are designed to have random suffixes because they may have multiple completions.</p>
<p>Example:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  completions: 5
  template:
    spec:
      containers:
      - name: pi
        image: perl
        command: [&quot;perl&quot;,  &quot;-Mbignum=bpi&quot;, &quot;-wle&quot;, &quot;print bpi(2000)&quot;]
      restartPolicy: Never
  backoffLimit: 4   
</code></pre>
<p>As you can see, this Job will be executed until it achieves 5 competitions, and it would not be possible if the name didn't have a random suffix attached to it. Check the result of the execution of the Job of the example:</p>
<pre><code>$ kubectl get pods 
NAME                            READY   STATUS      RESTARTS   AGE

pi-7mx4k                        0/1     Completed   0          3m9s
pi-bfw6p                        0/1     Completed   0          3m17s
pi-ls9lh                        0/1     Completed   0          3m43s
pi-njfpq                        0/1     Completed   0          3m35s
pi-ssn68                        0/1     Completed   0          3m27s
</code></pre>
<p>So, the answer to your question is no, you can't force it to use a &quot;fixed&quot; name.</p>
<p>If you need to have control under the name, consider using a Pod instead (kind Pod).</p>
