Declarative Jenkins Pipeline use existing Kubernetes Pod Template Declarative Jenkins Pipeline use existing Kubernetes Pod Template jenkins jenkins

Declarative Jenkins Pipeline use existing Kubernetes Pod Template


Here is an example using a pre-defined pod template.

pipeline {  agent {      label "maven"  }  stages {    stage('Run maven') {      steps {        sh 'mvn -version'      }    }  }}

Your original pipeline definition was in effect defining a brand new pod template and hence the error enforcing the requirement for containerTeamplates parameter. When using an existing template, you can simply specify the label in the agent block.


In fact, the error is related to the use of a bad version of the Kubernetes plugin, you need at least la version 1.6 as described in the wiki page.