I deploy my Spring projects to Kubernetes with Jenkins. I have k8smaster and 3 worker servers. It sometimes writes .m2 files under the k8smaster server. How can I prevent this? So I want it to write only on worker servers.
kubernetes nodes
I defined a label with a special name in Jenkins so that the job does not run on the master server, but it still works like a worker.
Jenkins List of volumes to mount in agent pod
Example pipeline
node ("zrgl-label") {
stage('Checkout'){
cleanWs()
withCredentials([gitUsernamePassword(credentialsId: 'zrgl.jenkins')]){
sh 'git clone -b ..'
}
}
stage('Kubernetes Deployment'){
container('kubectl'){
...
}
}
}