Ashish Kumar
Ashish Kumar

Reputation: 544

Jenkins slave pod keeps always running

I am trying to keep always the slave pod running. Unfortunately using Kubernetes agent inside the pipeline, I am still struggling with adding "podRetention" as always

Upvotes: 0

Views: 2671

Answers (1)

fredericrous
fredericrous

Reputation: 3038

For a declarative pipeline you would use idleMinutes to keep the pod longer

pipeline {
    agent {
       kubernetes {
            label "myPod"
            defaultContainer 'docker'
            yaml readTrusted('kubeSpec.yaml')
            idleMinutes 30
        }
    }

the idea is to keep the pod alive for a certain time for jobs that are triggered often, the one watching master branch for instance. That way if developers are on rampage pushing on master, the build will be fast. When devs are done we don't need the pod to be up forever and we don't want to pay extra resources for nothing so we let the pod kill itself

Upvotes: 2

Related Questions