I am on Jenkins 2.73.2.1 and using Kubernetes-jenkins plugin 1.4 to spin up dynamic slaves . However ,I am not able to start up parallel builds. Jenkins always puts it to build queue and executes one at a time.
I have tried setting this while starting jenkins but it doesn't help either:
-Dhudson.slaves.NodeProvisioner.initialDelay=0
-Dhudson.slaves.NodeProvisioner.MARGIN=50
-Dhudson.slaves.NodeProvisioner.MARGIN0=0.85
Is there any other setting we have to do at plugin configuration end for parallel pods running ?
The solution that worked for us was combination of above JVM arguments as well as selecting "use jobs matching the current label only" in kubernetes container template section.
We were able to run the required jobs parallelly in different pods
You have to configure the following parameters correctly in order to run slave concurrently and as per your expectation :
Under Kubernetes Pod Template
,
1) Set Labels
for Pod template correctly.
Jenkins Job
with the same label configured.Restrict where this project can be run
and provide the same label as you provided in Labels
field of Jenkins Configuration.2) Set Max number of instances
. This parameter will tell Jenkins How many maximum slaves it can launch with the given label
3) Set Time in minutes to retain agent when idle
. This parameter will tell Jenkins Till how much time to retain slave (with the given label) on which no build is running
.
Kubernetes Pod Creation time
.Pod Retention
policy is Default
.Under Cloud
section,
1) Set Container Cap
. This parameter will tell Jenkins How many slaves can be spawned on Kubernetes
.
Kubernetes cluster
.Max number of instances
is greater than Container Cap
. Jenkins will only be able to create slaves equal to Container Cap
for the label at best.Container Cap
equal to Sum of (Max number of instances) of all labels
While starting Jenkins
,
-Dhudson.slaves.NodeProvisioner.initialDelay=0
-Dhudson.slaves.NodeProvisioner.MARGIN=50
-Dhudson.slaves.NodeProvisioner.MARGIN0=0.85
Jenkins Kuberenetes Plugin' Github repo has good one-line description of all parameters