GoogleCloudPlatform / continuous-deployment-on-kubernetes

Get up and running with Jenkins on Google Kubernetes Engine
Apache License 2.0
1.6k stars 890 forks source link

Waiting for agent to connect (1/100), the JNLP can´t connect to master #129

Closed GangChenTFS closed 6 years ago

GangChenTFS commented 6 years ago

What the problem Base on above configuration, I did 2 test case:

  1. I use my specify images, there are 2 container will create in the same pod, include my define container,jenkins kubernetes plugin will auto create an JNLP container, but the actual command run in JNLP container, not in my specified container.
  2. I try to extend the jnlp-slave images(get it from office site), container name is "jnlp" in the kubenetes plugin pages (images is build by office docker file "https://hub.docker.com/r/jenkins/jnlp-slave/~/dockerfile/"), I first let the base jenkins/slave images works well, then try to extend it as I need. but when I try use default one, it always prompted "Waiting for agent to connect (1/100) ", it seems wait for JNLP client to connect, I enter the dynamic image which create by jenkins kubernetes plugin, I found there is not any process relation to "ENTRYPOINT ["jenkins-slave"]", I checked the jenkins logs, it prompted below info. Will be very glad for any kind of hint.

    Created Pod: kube-com-mini-fqt9p in namespace kube-system Waiting for Pod to be scheduled (0/100): kube-com-mini-fqt9p Container is waiting kube-com-mini-fqt9p [jnlp]: ContainerStateWaiting(message=null, reason=ContainerCreating, additionalProperties={}) Waiting for Pod to be scheduled (1/100): kube-com-mini-fqt9p Waiting for agent to connect (1/100): kube-com-mini-fqt9p Waiting for agent to connect (2/100): kube-com-mini-fqt9p Waiting for agent to connect (3/100): kube-com-mini-fqt9p Waiting for agent to connect (4/100): kube-com-mini-fqt9p Waiting for agent to connect (5/100): kube-com-mini-fqt9p Waiting for agent to connect (6/100): kube-com-mini-fqt9p Waiting for agent to connect (7/100): kube-com-mini-fqt9p Waiting for agent to connect (8/100): kube-com-mini-fqt9p Waiting for agent to connect (9/100): kube-com-mini-fqt9p Waiting for agent to connect (10/100): kube-com-mini-fqt9p Waiting for agent to connect (11/100): kube-com-mini-fqt9p Waiting for agent to connect (12/100): kube-com-mini-fqt9p Waiting for agent to connect (13/100): kube-com-mini-fqt9p Waiting for agent to connect (14/100): kube-com-mini-fqt9p

    ENV: $ kubectl version Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:08:19Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

Jenkins Version :Jenkins ver. 2.138

Jenkins kubernetes Plugin : 1.12.3

What I have done:

  1. Kubernetes cluster is running well
  2. Jenkins master server is independent with Kubernetes cluster.
  3. Jenkins kubernetes plugi get kubernetes credential and connection testing successfully.
  4. Added an kubernetes cloud with labeled POD. image
  5. Combined the label with a task of Jenkins by "Restrict where this project can be run"

FROM jenkins/slave:3.23-1-alpine MAINTAINER Oleg Nenashev o.v.nenashev@gmail.com LABEL Description="This is a base image, which allows connecting Jenkins agents via JNLP protocols" Vendor="Jenkins project" Version="3.23"

COPY jenkins-slave /usr/local/bin/jenkins-slave

ENTRYPOINT ["jenkins-slave"]

What I want to do:

Jenkins trigger jobs by curl command (not in the pipeline), jenkins kubernetes plugin can trigger jobs with my defined images.

gmsjr commented 6 years ago

I have the same problem...

GangChenTFS commented 6 years ago

This issue fixed with this steps.

  1. add 3 below line in your docker file , jenkins-slave can find from github. COPY jenkins-slave /usr/local/bin/jenkins-slave ENTRYPOINT ["jenkins-slave"]
  2. keep empty in "command to run " and argument to pass to the command" in container template 3 the container name has to be "jnlp"