<p>I am trying to keep always the slave pod running. Unfortunately using Kubernetes agent inside the pipeline, I am still struggling with adding &quot;podRetention&quot; as always</p>

Ashish Kumar
<p>For a declarative pipeline you would use idleMinutes to keep the pod longer</p>

<pre><code>pipeline {
    agent {
       kubernetes {
            label "myPod"
            defaultContainer 'docker'
            yaml readTrusted('kubeSpec.yaml')
            idleMinutes 30
        }
    }
</code></pre>

<p>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</p>
