Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins AWS Spot fleet plugin doesn't automatically scale spot instances

Planned to use EC2 Spot instance/fleet as our jenkins slave solution based on this article https://jenkins.io/blog/2016/06/10/save-costs-with-ec2-spot-fleet/.

EXCEPTED
if the spot instances nodes remain free for the specified idle time (I have configured for 5 minutes), then Jenkins releases the nodes, and my Spot fleet nodes will be automatically scaled down.

ACTUAL
my spot instances is still running for days.Also, noticed when I have more pending jobs, Jenkins does not automatically scale my Spot fleet to add more nodes.

Automatic scale up/down supposed to be triggered automatically by aws service? or is this supposed to be triggered by the jenkins plugin?

CONFIGURATION
Jenkins version : 2.121.2-1.1
EC2 Fleet Jenkins Plugin version : 1.1.7
Spot instance configuration :

  • Request type : request & maintain
  • Target Capacity : 1

Spot fleet plugin configuration :

  • Max Idle Minutes Before Scaledown : 5
  • Minimum Cluster Size : 0
  • Maximum Cluster Size : 3

Any help or lead would be really appreciated.

like image 678
Faisal Defry Hussainy Avatar asked Oct 03 '18 02:10

Faisal Defry Hussainy


1 Answers

I had the same issue and by looking in Jenkins' logs I saw it tried to terminate the instances but was refused to by AWS.

So, I checked in AWS Cloudtrail all the actions Jenkins tried and for which there was an error.

In order for the plugin to scale your Spot Fleet, check that your AWS EC2 Spot Fleet plugin has the following permissions with the right conditions:

ec2:TerminateInstances
ec2:ModifySpotFleetRequest

In my case, the condition in the policy was malformed and didn't work.

like image 111
KillianKemps Avatar answered Sep 30 '22 04:09

KillianKemps