We’re excited to announce that Elastigroup for Azure now supports Jenkins, providing Jenkins users with up to 80% savings on their compute costs. Elastigroup manages the nodes running Jenkins slaves on Azure’s Low-Priority VMs, which provide up to 80% cost savings compared to standard VMs. Combined with Elastigroup’s automated scaling based on the queue of pending jobs in Jenkins, the result is both optimal capacity management and cost efficiency.
How Elastigroup Manages Jenkins for Optimized Cost Efficiency
The Spotinst Jenkins Plugin (1) detects the number of queued jobs and scales Low-Priority VMs as nodes accordingly. (2) Nodes are provisioned across multiple VM types and Regions to optimize savings while still guaranteeing availability. (3) Provisioned nodes run a startup script to connect as Jenkins Slave nodes to the Jenkins Master and immediately start running jobs. (4) Automatically detect and terminate idle nodes.
Step 1: Create an Elastigroup
Log on to the Spotinst Console with an Azure connected account and create a Spotinst API Access Token. Save it for use in the Jenkins configuration. Create an Elastigroup for the Jenkins Slave nodes to run in. Utilize as many VM types and Regions as possible to maximize availability.
In the Compute tab, under Additional Configurations add the following user-data:
Step 2: Update the Slave Connect Port
The Jenkins Master – Slave connection is based on JNLP protocol.
By default, the Slaves try to connect on a random JNLP port, so the firewall rules need to be reconfigured in order to allow all ports to be open and ensure successful communications from Slave to Master.
To configure a fixed JNLP port for the Jenkins Slaves, navigate to Manage Jenkins >> Global Security>>Agents and set a static TCP port for JNLP agents. Then, configure the network to be available exclusively for this port.
Step 3: Installing the Spotinst Plugin for Jenkins
Log on to the Jenkins console and install the Spotinst Plugin from the available Plugins list.
After installing the plugin, Restart Jenkins.
Navigate to Manage Jenkins >> Configure System, scroll down to the Spotinst section and add the API Token generated in Step 1, along with the appropriate Account ID. Then click on Validate Token to ensure that the token is valid.
Once the Spotinst Token is set, scroll down towards the bottom to the Cloud section, Click on Add a new cloud and select Azure.
In the new parameters available, specify the Elastigroup ID for the Elastigroup created in Step 2 and Idle Minutes Before Termination to determine how long Elastigroup should wait before terminating an idle node.
You’re all set! Spotinst will now manage your Jenkins Slave nodes on Azure, providing you with 80% cost savings and automatically scaling up and down based on pending jobs.
For more on the Spotinst integration with Jenkins and troubleshooting, check out our Jenkins integration tutorial here.