GoogleCloudPlatform/continuous-deployment-on-kubernetes

Jenkins slave nodes can not exec kubectl command

wuxiaoqian726 opened this issue · 12 comments

Hello,
I am trying to use jenkins to deploy components to Kubernetes, per this project wiki, I already set up jenkins master node in Kubernetes cluster, and also installed Kubernetes plugin. If I started a new job with simple shell command execution, "ls -l" for example. Jenkins can create new pod in Kubernetes, and exec the ls command. If I changed the command to "kubectl get pods", job failed. The new pod has two docker containers, one is jenkins-k8s-slave, the other is jenkinsci/jnlp-slave:alpine. jenkinsci/jnlp-slave:alpine is the jenkins slave node, but this node does't install the gcloud and kubectl. jenkins-k8s-slave doesn't execute the jenkins-slave sh to connect to jenkins master.

podtemplate
pod
The first image is pod infomation, second one is the pod template configuration in jenkins interface. Could you help to check this? Per my understanding, jenkins-k8s-slave should also conntect to jenkins master and execute the command.

Change the container template name to jnlp and it should work. Out of curiosity when was our setup created? This should already by in the disk image.

Hello guys.

I'm struggling with the same issue, however, specifying 'jnlp' instead of container name doesn't help. If I put anything but 'jnlp' then slave is running and connecting to the master well. If I put 'jnlp' there then slave us running well but doesn't connect to master and in the logs I see this:

Waiting for agent to connect (41/100): kubernetes-agent-tgskx
Waiting for agent to connect (42/100): kubernetes-agent-tgskx
Waiting for agent to connect (43/100): kubernetes-agent-tgskx
Waiting for agent to connect (44/100): kubernetes-agent-tgskx
Waiting for agent to connect (45/100): kubernetes-agent-tgskx

Couldn't find an answer playing with configs for a long time. Jenkins URL is http://jenkins:8080 (as my service name is 'jenkins'). Jenkins tunnel is 'jenkins:50000'. Ports are exposed correctly.

Will be very glad for any kind of hint.

i have the same issue, Did you manage to solve it?

I met the same issue , anybody have solve it?

Any idea about thus issue? Anyone has a fix for this? This stackoveflow link was also not helpful - https://stackoverflow.com/questions/38969044/jenkins-kubernetes-jenkins-slave-node-is-offline/38969094

Hi Guys,

I am also facing the same issue, I have specified the name as "jnlp" with my custom slave image based on "jenkins/jnlp-slave". Can someone help??

Created Pod: jnlp-7mctg in namespace default
Waiting for Pod to be scheduled (0/100): jnlp-7mctg
Waiting for agent to connect (0/100): jnlp-7mctg
Waiting for agent to connect (1/100): jnlp-7mctg
Waiting for agent to connect (2/100): jnlp-7mctg
Waiting for agent to connect (3/100): jnlp-7mctg
Waiting for agent to connect (4/100): jnlp-7mctg

image

The latest update to the tutorial in #96. Fixes this issue by having users configure their pods explicitly in the Jenkinsfile and letting the Kubernetes plugin inject the jnlp container:

https://github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes/blob/master/sample-app/Jenkinsfile#L7

Same issue, I have to connect to custom jnlp container .. please help me

I am seeing the same issue. What i noticed is that using the helm chart for jenkins and installing the K8 plugin the basic podtemplate declared in the Manage Jenkins section with a label kicks of a slave agent, connects using jnlp4 and works fine. However, when it comes to a custom jnlp image though i specify the name as "jnlp" I have hardly had any success with this.

Same issue again for me as well for the custom Jenkins slave JNLP image.

Hello All,

Does anyone find a solution for this? our can share a way to costom jnlp-slave images. thanks.