james
james

Reputation: 11

Why are our Jenkins Kubernetes Pods/Slaves showing as Offline

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}

Upvotes: 1

Views: 4576

Answers (1)

nichmidd
nichmidd

Reputation: 21

your issue maybe the command and arguments.

the command should be blank, and the arguments should be set to:

${computer.jnlpmac} ${computer.name}

this will allow the jnlp slave to connect to the jenkins master correctly

Upvotes: 1

Related Questions