19

I wonder if that would be possible to temporary stop the worker VM instances so they are not running at night time when I am not working on a cluster development. So far the only way I am aware of to "stop" the instances from running is to delete the cluster itself which I don't want to do. Any suggestions are highly appreciated.

P.S. Edited later

The cluster was created following steps outlined in this guide.

alphanumeric
  • 17,967
  • 64
  • 244
  • 392
  • 2
    How did you create your EKS worker nodes? Have you used the Cloud Formation template provided by [this](https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html) guide? If so, I think you can just update your Cloud Formation config and set _NodeAutoScalingGroupDesiredCapacity_ to _0 (zero)_. – Eduardo Baitello Jul 16 '19 at 01:36
  • I created cluster by following the steps outlined in this guide: https://docs.aws.amazon.com/eks/latest/userguide/getting-started-console.html – alphanumeric Jul 16 '19 at 01:41

4 Answers4

16

I'm just learning myself but this might help. If you have eksctl installed, you can use it from the command line to scale your cluster. I scale mine down to the min size when I'm not using it:

eksctl get cluster
eksctl get nodegroup --cluster CLUSTERNAME
eksctl scale nodegroup --cluster CLUSTERNAME --name NODEGROUPNAME --nodes NEWSIZE

To completely scale down the nodes to zero use this (max=0 threw errors):

eksctl scale nodegroup --cluster CLUSTERNAME --name NODEGROUPNAME --nodes 0 --nodes-max 1 --nodes-min 0

peter n
  • 1,210
  • 13
  • 18
jrk
  • 656
  • 6
  • 16
14

Go to EC2 instances dashboard of your Node Group and from right panel in bottom click on Auto Scaling Groups then select your group by click on checkbox and click edit button and change Desired, Min & Max capacities to 0

Auto Scaling groups -> Group size

5

Edit the autoscaling group and set the instances to 0. This will shut down all worker nodes. Now you can use AWS Automation to schedule a repetitive action through automation documents that will be stopping/starting at given periods of time. You can't stop the master nodes as they are managed by AWS.

2

Take a look at the kube-downscaler which can be deployed to cluster to scale in and out the deployments based on time of day.

More cost reduction techniques in this blog.

Farrukh Najmi
  • 5,055
  • 3
  • 35
  • 54