jenkins in k8s,pod jnlp-slave start error

3/13/2019

jenkins in k8s configration finished,
refer to https://zhangchenchen.github.io/2017/12/17/achieve-cicd-in-kubernetes-with-jenkins/
but the pod can not start up correct。
k8s configration ok,
pod template,
and job config: job config
and simple job content
result: job pennding for a long time job running state

I find the pod logs, the error message is:

kubectl logs -f jnlp-slave-f5jxv jnlp

Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior  
Mar 14, 2019 1:14:36 AM hudson.remoting.jnlp.Main createEngine  INFO: Setting up agent: jnlp-slave-f5jxv   
Mar 14, 2019 1:14:36 AM hudson.remoting.jnlp.Main$CuiListener <init>  INFO: Jenkins agent is running in headless mode.  
Mar 14, 2019 1:14:36 AM hudson.remoting.Engine startEngine  INFO: Using Remoting version: 3.28    
Mar 14, 2019 1:14:36 AM hudson.remoting.Engine startEngine WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars   
Mar 14, 2019 1:14:36 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Locating server among [http://jenkins.devops:80/]  
Mar 14, 2019 1:14:36 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]  
Mar 14, 2019 1:14:37 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Agent discovery successful  
Agent address: jenkins.devops  
Agent port:    30084  
Identity:      cd:c8:04:06:4f:02:f5:04:96:52:c9:7a:9d:b1:45:3d  

Mar 14, 2019 1:14:37 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Handshaking  
Mar 14, 2019 1:14:37 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Connecting to jenkins.devops:30084  
Mar 14, 2019 1:14:37 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Trying protocol: JNLP4-connect  
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Protocol JNLP4-connect encountered an unexpected exception  

java.util.concurrent.ExecutionException:   
org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent  
    at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)  
    at hudson.remoting.Engine.innerRun(Engine.java:614)  
    at hudson.remoting.Engine.run(Engine.java:474)  
Caused by: org.jenkinsci.remoting.protocol.impl.ConnectionRefusalException: Connection closed before acknowledgement sent  
    at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.onRecvClosed(AckFilterLayer.java:280)  
    at org.jenkinsci.remoting.protocol.FilterLayer.abort(FilterLayer.java:164)  
    at org.jenkinsci.remoting.protocol.impl.AckFilterLayer.access$000(AckFilterLayer.java:43)   
    at org.jenkinsci.remoting.protocol.impl.AckFilterLayer$1.run(AckFilterLayer.java:176)  
    at org.jenkinsci.remoting.protocol.IOHub$DelayedRunnable.run(IOHub.java:964)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)   
    at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93)   
    at java.lang.Thread.run(Thread.java:748)   

Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status  INFO: Connecting to jenkins.devops:30084   
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status INFO: Server reports protocol JNLP4-plaintext not supported, skipping   
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status INFO: Protocol JNLP3-connect is not enabled, skipping   
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status INFO: Server reports protocol JNLP2-connect not supported, skipping  
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener status INFO: Server reports protocol JNLP-connect not supported, skipping  
Mar 14, 2019 1:14:48 AM hudson.remoting.jnlp.Main$CuiListener error   SEVERE: The server rejected the connection: None of the protocols were accepted   

java.lang.Exception: The server rejected the connection: None of the protocols were accepted   
    at hudson.remoting.Engine.onConnectionRejected(Engine.java:682)  
    at hudson.remoting.Engine.innerRun(Engine.java:639)  
    at hudson.remoting.Engine.run(Engine.java:474)  

# kubectl -n futao get pod -o wide
NAME               READY   STATUS   RESTARTS   AGE     IP              NODE                  NOMINATED NODE
jnlp-slave-g5dph   0/2     Error    0          6m41s   10.233.123.78   node-192.168.35.118   <none>

kubectl -n futao describe  pod jnlp-slave-g5dph 
Name:               jnlp-slave-klnmm
Namespace:          futao
Priority:           0
PriorityClassName:  <none>
Node:               master-192.168.34.71/192.168.34.71
Start Time:         Thu, 14 Mar 2019 09:21:33 +0800
Labels:             jenkins=slave
                jenkins/jnlp-slave=true
Annotations:        <none>
Status:             Failed
IP:                 10.233.67.213
Containers:
  jnlp-slave:
    Container ID:docker://0e6dec4d08f92bd78496ea6d924b89665a721e10a34b6035383ae3f7d626a5b1
Image:         jenkinsci/jnlp-slave
Image ID:      docker-pullable://jenkinsci/jnlp-slave@sha256:38ad49954fd41a6f4717b93760ef0a89af5a4c84898d2b56eab871e4598a2c54
Port:          <none>
Host Port:     <none>
Args:
  547d60f605d207af24b99c96bf9c7fe5ca7ccd818a894d7bc5cbb8e137889558
  jnlp-slave-klnmm
State:          Terminated
  Reason:       Error
  Exit Code:    255
  Started:      Thu, 14 Mar 2019 09:21:35 +0800
  Finished:     Thu, 14 Mar 2019 09:21:47 +0800
Ready:          False
Restart Count:  0
Environment:
  JENKINS_SECRET:      547d60f605d207af24b99c96bf9c7fe5ca7ccd818a894d7bc5cbb8e137889558
  JENKINS_AGENT_NAME:  jnlp-slave-klnmm
  JENKINS_NAME:        jnlp-slave-klnmm
  JENKINS_URL:         http://jenkins.devops:80/
  HOME:                /home/jenkins
Mounts:
  /home/jenkins from workspace-volume (rw)
  /var/run/secrets/kubernetes.io/serviceaccount from default-token-sdcrq (ro)
jnlp:
  Container ID:   docker://1762e18b8bb773af9c31aadcb5dd32b6642b9640845871aa96ff1fadb7b774d2
  Image:          jenkins/jnlp-slave:alpine
  Image ID:       docker-pullable://jenkins/jnlp-slave@sha256:8e330d8bc461440c797d543b9872e54b328da3ef3b052180bb5aed33204d4384
  Port:           <none>
  Host Port:      <none>
  State:          Terminated
    Reason:       Error
    Exit Code:    255
    Started:      Thu, 14 Mar 2019 09:21:36 +0800
    Finished:     Thu, 14 Mar 2019 09:21:49 +0800
  Ready:          False
  Restart Count:  0
  Environment:
    JENKINS_SECRET:      547d60f605d207af24b99c96bf9c7fe5ca7ccd818a894d7bc5cbb8e137889558
    JENKINS_AGENT_NAME:  jnlp-slave-klnmm
    JENKINS_NAME:        jnlp-slave-klnmm
    JENKINS_URL:         http://jenkins.devops:80/
    HOME:                /home/jenkins
  Mounts:
    /home/jenkins from workspace-volume (rw)
    /var/run/secrets/kubernetes.io/serviceaccount from default-token-sdcrq (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
PodScheduled      True 
Volumes:
  workspace-volume:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:  
  default-token-sdcrq:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-sdcrq
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type    Reason     Age   From                           Message
  ----    ------     ----  ----                           -------
  Normal  Scheduled  66s   default-scheduler              Successfully assigned futao/jnlp-slave-klnmm to master-192.168.34.71
  Normal  Pulled     63s   kubelet, master-192.168.34.71  Container image "jenkinsci/jnlp-slave" already present on machine
  Normal  Created    63s   kubelet, master-192.168.34.71  Created container
  Normal  Started    62s   kubelet, master-192.168.34.71  Started container
  Normal  Pulled     62s   kubelet, master-192.168.34.71  Container image "jenkins/jnlp-slave:alpine" already present on machine
  Normal  Created    62s   kubelet, master-192.168.34.71  Created container
  Normal  Started    62s   kubelet, master-192.168.34.71  Started containe
-- tony fu
jenkins-pipeline
kubernetes

0 Answers