<p>I have an EKS cluster with two worker nodes. I would like to &quot;switch off&quot; the nodes or do something to reduce costs of my cluster outside working hours. Is there any way to turn off the nodes at night and turn on again at morning?</p>
<p>Thanks a lot.</p>

Humberto Lantero
<p>This is a very common concern with anyone using managed K8s cluster. There might be different approaches people might be taking for this. What works best for us is a combination of <code>kube-downscaler</code> and <code>cluster-autoscaler</code>.</p>
<p><a href="https://codeberg.org/hjacobs/kube-downscaler" rel="nofollow noreferrer">kube-downscaler</a> helps you to scale down / &quot;pause&quot; Kubernetes workload (Deployments, StatefulSets, and/or HorizontalPodAutoscalers and CronJobs too !) during non-work hours.</p>
<p><a href="https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler" rel="nofollow noreferrer">cluster-autoscaler</a> is a tool that automatically:</p>
<ol>
<li><p>Scales-down the size of the Kubernetes cluster when there are nodes in the cluster that have been underutilized for an extended period of time and their pods can be placed on other existing nodes.</p>
</li>
<li><p>Scales-up the size of the Kubernetes cluster when there are pods that failed to run in the cluster due to insufficient resources.</p>
</li>
</ol>
<p>So, essentially during night when <code>kube-downscaler</code> scales down the pods and other objects, <code>cluster-autoscaler</code> notices the underutilized nodes and kill them before placing pods on other nodes. And does the opposite in the morning.</p>
<p>Ofcourse, there might be some fine-tuning needed regarding the configuration of the two to make it work best for you.</p>
