title: What is the best way to delete a Pod after a Kubernetes Job completes
body: <p>I have a situation in which I run a Kubernetes Job and then want to delete the pod in which the Job's containers run when the job completes. The <a href="https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/#job-termination-and-cleanup" rel="noreferrer">Kubernetes documentation says</a> the it is the responsibility of the user to delete the pod.</p>
  
  <p>However, my goal is to run a CPU intensive job by spinning up a big honking pod, let the job run, and then upon job completion, automagically nuke the pod. My thinking is that paying for an expensive, resource intensive pod is worth it when the revenue producing job runs. Once the job is over, the revenue stream ends and I need to cut the expense, hence nuking the pod.</p>
  
  <p>I am thinking of having my code in the job container send a out a message upon program completion to a publisher that is picked up by a subscriber. The subscriber knows how to run the command, <code>kubectl delete jobs/myContainer</code> to nuke the pod.</p>
  
  <p>But, maybe there is a better way. Thus, I ask.</p>
  
  <p>Thanks in advance.</p>