<p>When a Job completes, no more Pods are created, but the Pods are not deleted either.</p>
<p><a href="https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-termination-and-cleanup" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-termination-and-cleanup</a></p>
<ol>
<li>clear it by another cronjob.</li>
<li>use operator to wrapper it and add remove mechanism in the operator.</li>
</ol>

CC BY-SA 4.0
2021-05-15T11:35:15.553Z
Thanks - I don't mind if the pods stay around, but I want the actual nodes to scale back down automatically. Which they do sometimes but not always.
Duncan Felix
CC BY-SA 4.0
2021-05-16T12:02:37.277Z
The hanging pod could be the reason that clusterscaler does not scale down the node. Try to manually delete them to verify if it works. How do you ensure that the job takes the whole resource of the node? If via the required resources, you might try the node selector + podAntiAfinity and only requires fewer resources.
Jerry Chen
CC BY-SA 4.0
2021-05-14T09:46:07.703Z
2021-05-14T11:38:05.743Z
2021-05-14T11:38:05.743Z
Jerry Chen
<p>I have large Kubernates jobs which take the whole resources of one node / droplet in Digitalocean (it's not running on AWS).</p>
<p>Using resources in a deploy.yaml, the cluster autoscaler works to scale up, but sometimes the nodes continue to run instead of killing / scaling down when the job is done.</p>
<p>How do I make sure the nodes get killed when the job is done? They are expensive!</p>

<kubernetes>
How to ensure Nodes are killed when Job is finished using Cluster Autoscaler in Kubernates
Duncan Felix
# How to ensure Nodes are killed when Job is finished using Cluster Autoscaler in Kubernates

(Asked by: username_0 on 2021-05-13)

I have large Kubernates jobs which take the whole resources of one node / droplet in Digitalocean (it's not running on AWS).

Using resources in a deploy.yaml, the cluster autoscaler works to scale up, but sometimes the nodes continue to run instead of killing / scaling down when the job is done.

How do I make sure the nodes get killed when the job is done? They are expensive!

**Tags:** kubernetes


---

## 1 answers

### Answer by username_1 on 2021-05-14. Score: 1

When a Job completes, no more Pods are created, but the Pods are not deleted either.

<https://kubernetes.io/docs/concepts/workloads/controllers/job/#job-termination-and-cleanup>

1. clear it by another cronjob.
2. use operator to wrapper it and add remove mechanism in the operator.

> **Comments:**
> **username_0**: Thanks - I don't mind if the pods stay around, but I want the actual nodes to scale back down automatically. Which they do sometimes but not always.  
> **username_1**: The hanging pod could be the reason that clusterscaler does not scale down the node. Try to manually delete them to verify if it works. How do you ensure that the job takes the whole resource of the node? If via the required resources, you might try the node selector + podAntiAfinity and only requires fewer resources.  

---

