<p>I have deployed a pod in kubernetes cluster that run a python script.</p>
<p>The problem is i want to force the k8s to stop the container after the script complete his job and not to re-create another pod.</p>
<p>To be aware that i have tried to use kind:job but it doesn't fulfill my need.</p>
<p>I tried two types of kind, job and deployments.</p>
<p>With the deployment the pod always show status first completed after that crush with crashloopbackof error.</p>
<p>With the job the pod always show the status completed but i don't have the possibility to re-excute it with an automated way</p>
<p>Do you have any suggestions about that?</p>

<p>I have posted community wiki answer to summarise the topic.</p>
<p>User <a href="https://stackoverflow.com/users/213269/jonas" title="108,324 reputation">Jonas</a> has posted great suggestions:</p>
<blockquote>
<p>A kind <code>Job</code> does exactly this. Use <code>Job</code> and your problem is solved.</p>
</blockquote>
<blockquote>
<p>If you deploy with <code>kubectl create -f job.yaml</code> and your job has a <code>generateName:</code> instead of <code>name:</code>, a new <code>Job</code> will be created each time.</p>
</blockquote>
<p>For more information look at the documentation about <a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/" rel="nofollow noreferrer">Jobs</a>. See also information about <a href="https://kubernetes.io/docs/reference/using-api/api-concepts/#generated-values" rel="nofollow noreferrer">Gnerated values</a>.</p>
