kubernetes dynamic jenkins slaves with multiple build executors

3/19/2019

Is it possible to have dynamic slaves with multiple build execution lanes using Kubernetes plugin for Jenkins?

I currently have a jenkins scripted pipeline job that is trying to run a parallel instruction with 25 branches and this is hitting a soft limit (Container Cap/Max number of instances) configured in our Kubernetes Jenkins slave cloud.

Currently, each pod that gets created on demand to be a build slave, possesses only one build lane and I wonder if is there a way to spread the workload amongst existing slave pods.

-- Rogério Peixoto
continuous-integration
devops
docker
jenkins
kubernetes

2 Answers

3/20/2019

You can use the deployment or replication set model of the kubernetes framework. This will automatically scale the pods based on the load and number of replicas required. Moreover, the underlying hardware shall also support the same.
A Deployment is more powerful and robust than a job/pod of a kubernetes.

-- Vinod Kumar
Source: StackOverflow

3/20/2019

It is not possible to somehow reuse slave pods by Kubernetes plugin.

Kubernetes slaves designed to be a stateless, run only one job and die after. That 's why

But, for example, you can create a Pipeline which will get a list of all branches and run them in parallel inside one job/pod.

But anyway, you need to do it by yourself, Kubernetes plugin has no automation for it.

-- Anton Kostenko
Source: StackOverflow