<p>We use GKE in one of our service which is autoscaled. The workload is variable and based on the workload the cluster scales upto hundreds of nodes. However i see that when the workload goes down many of the nodes which are idle still are alive for very long time and hence increasing our bill. Is there a setting we can do where we can specify a time after which a node will be terminated and removed from the cluster?</p>

Raghvendra Singh
<p>The Kubernetes scaling-down process typically includes a delay as a protection from peak traffic spikes that can eventually occurs while performing the resize.</p>

<p>As well, there are several aspect about the autoscaler to consider. Please check the following docs for details:</p>

<ul>
<li><p><a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-does-scale-down-work" rel="nofollow noreferrer">https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#how-does-scale-down-work</a></p></li>
<li><p><a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node" rel="nofollow noreferrer">https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-types-of-pods-can-prevent-ca-from-removing-a-node</a></p></li>
</ul>

<p>Furthermore, when using the GKE autoscaler, there are some constraints to take into account:</p>

<blockquote>
  <ul>
  <li>When scaling down, cluster autoscaler honors a graceful termination
  period of 10 minutes for rescheduling the node's Pods onto a different
  node before forcibly terminating the node.</li>
  <li>Occasionally, cluster autoscaler cannot scale down completely and an extra node exists after scaling down. This can occur when required system Pods are scheduled
  onto different nodes, because there is no trigger for any of those
  Pods to be moved to a different node. See <a href="https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#i-have-a-couple-of-nodes-with-low-utilization-but-they-are-not-scaled-down-why" rel="nofollow noreferrer">I have a couple of nodes
  with low utilization, but they are not scaled down. Why?</a>. To work
  around this limitation, you can configure a <a href="https://kubernetes.io/docs/concepts/workloads/pods/disruptions/" rel="nofollow noreferrer">Pod disruption budget</a>.</li>
  </ul>
</blockquote>

<hr>

<p><em>Disclaimer: Comments and opinions are my own and not the views of my employer.</em></p>
