1
votes

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.
1
What is running in the pod jenkins-pod-slave-d4j3n? When jenkins run job there's need to jnlp 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.3h4x
The Kubernetes Pod Template is set up to run as follows. Name: Jenkins-Pod-Slave. Namespace: default Label: autoscale. The container Template uses the following information : Name jnlp, Docker Image: jenkinsci/jnlp-slave, Working Directory: /home/jenkins, Command to run slave agent; /bin/sh -c, Arguments to pass to the command: catjames
I need more information than that. In cloud configuration what is: - Jenkins URL - Jenkins tunnel How is jenkins jnlp connecting to jenkins? Are the right ports exposed? Exec container and see what it's doing. Change pod template to run simple busybox and see what is happening.3h4x
And show kubectl describe on the pod3h4x
Did you solve the problem? Please share your solutionxbmono

1 Answers

1
votes

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