Jenkins ver. 2.77 K8s Version: v1.6.6"
We have installed the Jenkins Kubernetes Plugin and configured it to work with our K8s Cluster. We are able to succesfully connect to the cluster when we test our connection via “Manage Jenkins” -> “Configure System” -> Cloud, Kubernetes.
Our Template config can be seen here
Kubernetes Pod Termplate Config
We then create a simple job to test the plugin and see if the slaves would be created and then run a few simple bash commands.
The bash commands we are testing are:
sleep 10
echo "I am a slave"
echo "This is a K8s plugin generated slave"
When we configured our Plugin we assigned the label "autoscale". In addition we set up our job to work with the label autoscale.
Within the configuration of the Job under Label Expression we also see the following "Label autoscale is serviced by no nodes and 1 cloud"
We then start the job in Jenkins "Build Now" We then see the pods created in our K8s cluster
jenkins-pod-slave-d4j3n 1/1 Running 0 21h
jenkins-pod-slave-tb2td 1/1 Running 0 21h
However note that under Build History we can see the following message
1
(pending—All nodes of label ‘autoscale’ are offline)
Investigating the logs of the pods outputs nothing
kubectl logs jenkins-pod-slave-d4j3n
kubectl logs jenkins-pod-slave-tb2td
Investigation of the Jenkins logs we can see the following message appear.
Oct 08, 2017 6:18:16 PM org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud addProvisionedSlave INFO: Template instance cap of 2 reached for template Jenkins-Pod-Slave, not provisioning: 2 running in namespace {3} with label {4}
- Our concern is that the namespace and label value are not being picked up correctly, and could be the source of the problem.
jenkins-pod-slave-d4j3n
? When jenkins run job there's need tojnlp
container connecting to jenkins successfully. This state running is for how long? Does it timeout eventually because maybe you have wrong jenkins URL or no 50000 port exposed. Provide more information about your cluster and jenkins configuration. – 3h4xkubectl describe
on the pod – 3h4x