Kubernetes上的Jenkins slave无法连接tcpSlaveAgentListener/:

46qrfjad  于 2023-05-22  发布在  Jenkins
关注(0)|答案(3)|浏览(855)

我试图使用K8s设置Jenkins slave,传递正确的代理名称和密码,但试图连接到一个奇怪的URL:
不断创建从站并使用完全相同的日志删除它们。
主日志:

2020-02-03 21:20:39.980+0000 [id=26]    INFO    o.c.j.p.k.KubernetesCloud#provision: Template for label slave: jenkins-slave
2020-02-03 21:20:50.005+0000 [id=31]    INFO    hudson.slaves.NodeProvisioner#lambda$update$6: Kubernetes Pod Template provisioning successfully completed. We have now 3 computer(s)
2020-02-03 21:20:50.026+0000 [id=26914] INFO    o.c.j.p.k.KubernetesLauncher#launch: Created Pod: toks1/jenkins-slave-ncn4x
2020-02-03 21:20:54.547+0000 [id=26922] INFO    h.TcpSlaveAgentListener$ConnectionHandler#run: Connection #122 failed: java.io.EOFException
2020-02-03 21:20:54.660+0000 [id=26923] INFO    h.TcpSlaveAgentListener$ConnectionHandler#run: Accepted JNLP4-connect connection #123 from /10.128.0.1:41682
2020-02-03 21:20:54.864+0000 [id=26914] INFO    o.c.j.p.k.KubernetesLauncher#launch: Pod is running: toks1/jenkins-slave-ncn4x
2020-02-03 21:20:54.867+0000 [id=26914] INFO    o.c.j.p.k.KubernetesLauncher#launch: Waiting for agent to connect (0/100): jenkins-slave-ncn4x
2020-02-03 21:20:55.885+0000 [id=26914] INFO    o.c.j.p.k.KubernetesLauncher#launch: Waiting for agent to connect (1/100): jenkins-slave-ncn4x
2020-02-03 21:20:56.891+0000 [id=26914] INFO    o.c.j.p.k.KubernetesLauncher#launch: Container is terminated jenkins-slave-ncn4x [jnlp]: ContainerStateTerminated(containerID=docker://16631d7785e73264c48e814ae56c337293d7028102e5ce7845bdb8fd96664238, exitCode=255, finishedAt=2020-02-03T21:20:55Z, message=null, reason=Error, signal=null, startedAt=2020-02-03T21:20:53Z, additionalProperties={})
2020-02-03 21:20:56.927+0000 [id=26914] SEVERE  o.c.j.p.k.KubernetesLauncher#logLastLines: Error in provisioning; agent=KubernetesSlave name: jenkins-slave-ncn4x, template=PodTemplate{inheritFrom='', name='jenkins-slave', namespace='toks1', hostNetwork=false, label='slave', nodeSelector='', nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], containers=[ContainerTemplate{name='slave', image='docker.io/fabstao/jenkins-okd-slave:3', alwaysPullImage=true, workingDir='/home/jenkins/agent', command='', args='', resourceRequestCpu='', resourceRequestMemory='', resourceLimitCpu='', resourceLimitMemory='', envVars=[KeyValueEnvVar [getValue()=http://jenkins-gtsmex:8080 , getKey()=JENKINS_URL], KeyValueEnvVar [getValue()=slave-gts, getKey()=JENKINS_AGENT_NAME], KeyValueEnvVar [getValue()=2a1be5874407a37957eeba186c228c756ac8dbc78f0c4edb735399d15834d5ca, getKey()=JENKINS_SECRET]], livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@70ba28dc}]}. Container jnlp exited with error 255. Logs: INFO: Using Remoting version: 3.35
Feb 03, 2020 9:20:54 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/jenkins/agent/remoting as a remoting work directory
Feb 03, 2020 9:20:54 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Feb 03, 2020 9:20:54 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://jenkins-gtsmex-toks1.toks1.default.svc.cluster.local/ ]
Feb 03, 2020 9:20:54 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to http://jenkins-gtsmex-toks1.toks1.default.svc.cluster.local/tcpSlaveAgentListener/:  jenkins-gtsmex-toks1.toks1.default.svc.cluster.local
java.io.IOException: Failed to connect to http://jenkins-gtsmex-toks1.toks1.default.svc.cluster.local/tcpSlaveAgentListener/:  jenkins-gtsmex-toks1.toks1.default.svc.cluster.local
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:206)
    at hudson.remoting.Engine.innerRun(Engine.java:527)
    at hudson.remoting.Engine.run(Engine.java:488)
Caused by: java.net.UnknownHostException: jenkins-gtsmex-toks1.toks1.default.svc.cluster.local
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
    at sun.net.www.http.HttpClient.New(HttpClient.java:357)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:203)
    ... 2 more

从属日志:

Feb 03, 2020 9:27:13 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: slave-gts
Feb 03, 2020 9:27:13 PM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Feb 03, 2020 9:27:13 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3.40
Feb 03, 2020 9:27:13 PM hudson.remoting.Engine startEngine
WARNING: No Working Directory. Using the legacy JAR Cache location: /home/jenkins/.jenkins/cache/jars
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://jenkins-gtsmex:8080 ]
Feb 03, 2020 9:27:14 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
  Agent address: jenkins-gtsmex
  Agent port:    50000
  Identity:      f5:f7:64:eb:8c:aa:57:81:07:27:2e:38:e1:93:b7:e5
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to jenkins-gtsmex:50000
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: f5:f7:64:eb:8c:aa:57:81:07:27:2e:38:e1:93:b7:e5
Feb 03, 2020 9:27:14 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected

Kubernetes:Openshift OKD 3.11 Jenkins:2.218
请帮帮我

ct2axkht

ct2axkht1#

首先访问http://your-jenkins-ip:8080/configureSecurity/并将值Agents:TCP port for JNLP agents设置为random
然后将工作目录设置为/home/jenkins
看看这里:jenkins-kubernetes
正式文件:jenkins-plugin-kubernetes

djmepvbi

djmepvbi2#

我在Openshift 4.3上更新了Jenkins图像,现在它工作了,所以我将关闭这个问题,并保留OKD 3.11的其他问题,因为我有不同的问题。

iqih9akk

iqih9akk3#

您的代理无法通过http://jenkins-gtsmex-toks1.toks1.default.svc.cluster.local/连接您的Jenkins
请确认您的服务为'jenkins-gtsmex-toks1.toks1.default.svc.cluster.local',服务端口为80
jenkins的默认端口是8080

相关问题