Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop AWS EKS Worker Instances

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.

like image 336
alphanumeric Avatar asked Jul 16 '19 00:07

alphanumeric


4 Answers

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

like image 69
Fisal Assubaieye Avatar answered Oct 27 '22 00:10

Fisal Assubaieye


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

like image 39
jrk Avatar answered Oct 27 '22 00:10

jrk


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.

like image 5
anVzdGFub3RoZXJodW1hbg Avatar answered Oct 26 '22 23:10

anVzdGFub3RoZXJodW1hbg


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.

like image 1
Farrukh Najmi Avatar answered Oct 27 '22 01:10

Farrukh Najmi