Reputation: 53
I have jenkins running on Windows as a service on 127.0.0.1:8080
and minikube running on 192.168.99.101
below is the pipeline for Jenkins job
podTemplate(
activeDeadlineSeconds: 240,
name: 'default',
inheritFrom: 'default',
nodeSelector: 'key1=value1,kubernetes.io/hostname=minikube',
containers: [
containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat' ),
containerTemplate(name: 'jnlp', image: 'jenkins/jnlp-slave:3.35-2-alpine', args: '${computer.jnlpmac} ${computer.name}')
]) {
node(POD_LABEL) {
stage('Get a Maven project') {
git 'https://github.com/<project>.git/'
container('maven') {
stage('Build a Maven project') {
sh 'mvn -B -gs ./settings.xml clean install'
}
}
}
}
}
The following are the logs for from the kubernetes:
$ kubectl get -a pods --watch
Flag --show-all has been deprecated, will be removed in an upcoming release
NAME READY STATUS RESTARTS AGE
default-7r0n8-b2sxx 0/2 Pending 0 0s
default-7r0n8-b2sxx 0/2 Pending 0 0s
default-7r0n8-b2sxx 0/2 ContainerCreating 0 0s
default-7r0n8-b2sxx 2/2 Running 0 0s
default-7r0n8-b2sxx 1/2 Error 0 1s
default-7r0n8-18cv6 0/2 Pending 0 0s
default-7r0n8-18cv6 0/2 Pending 0 0s
default-7r0n8-18cv6 0/2 ContainerCreating 0 0s
default-7r0n8-18cv6 2/2 Running 0 0s
default-7r0n8-18cv6 1/2 Error 0 2s
default-7r0n8-0kz80 0/2 Pending 0 0s
default-7r0n8-0kz80 0/2 Pending 0 0s
default-7r0n8-0kz80 0/2 ContainerCreating 0 0s
default-7r0n8-0kz80 2/2 Running 0 0s
default-7r0n8-0kz80 1/2 Error 0 1s
The following is the console's output from the jenkins job
The pods are getting killed and recreated each time.
Please Can anyone help how to resolve this issue?
Any help would be appreciated.
pod logs
Upvotes: 3
Views: 6566
Reputation: 59
I have the same problem since yesterday. Navigate to Configure Clouds --> kubernetes --> Pod Template. Set Pod Retention as 'Always'. Pods will stay in error status. You can get the pod logs with command kubectl logs --all-containers and see the error reason. In my case Jenkins URL and Jenkins Tunnel is not set properly.
Refer to https://www.youtube.com/watch?v=DCkzdsffeh0
It gives details for jenkins and kubernetes plugin configuration
Upvotes: 4