使用带有 jenkins 的 kubernetes 插件在 kubernetes 上启动 jenkins 代理时出现的问题

使用带有 jenkins 的 kubernetes 插件在 kubernetes 上启动 jenkins 代理时出现的问题

我在尝试将 jenkins 服务器集成到 kubernetes 集群以便 jenkins 代理在 kubernetes 集群上运行作业时遇到以下错误

2020-02-06 17:21:26.875+0000 [id=961]   WARNING o.c.j.p.k.KubernetesLauncher#launch: Error in provisioning; agent=KubernetesSlave name: kubernetes-1f2n5, template=PodTemplate{inheritFrom='', name='kubernetes', namespace='', label='kubernetes', serviceAccount='default', nodeSelector='', nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='joao29a/jnlp-slave-alpine-docker', workingDir='/home/jenkins/', command='', args='', ttyEnabled=true, resourceRequestCpu='', resourceRequestMemory='', resourceLimitCpu='', resourceLimitMemory='', envVars=[KeyValueEnvVar [getValue()=http://x.x.x.x:8080, getKey()=JENKINS_URL]], livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@de43a86}]}
io.fabric8.kubernetes.client.KubernetesClientException:
    at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$1.onFailure(WatchConnectionManager.java:198)
    at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.java:571)
    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:198)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
2020-02-06 17:21:26.876+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#_terminate: Terminating Kubernetes instance for agent kubernetes-1f2n5
2020-02-06 17:21:26.890+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#deleteSlavePod: Terminated Kubernetes instance for agent test/kubernetes-1f2n5
2020-02-06 17:21:26.890+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#_terminate: Disconnected computer kubernetes-1f2n5
Terminated Kubernetes instance for agent test/kubernetes-1f2n5
Disconnected computer kubernetes-1f2n5
2020-02-06 17:21:36.747+0000 [id=31]    INFO    o.c.j.p.k.KubernetesCloud#provision: Excess workload after pending Kubernetes agents: 1
2020-02-06 17:21:36.747+0000 [id=31]    INFO    o.c.j.p.k.KubernetesCloud#provision: Template for label kubernetes: Kubernetes Pod Template
2020-02-06 17:21:36.756+0000 [id=31]    INFO    h.s.NodeProvisioner$StandardStrategyImpl#apply: Started provisioning Kubernetes Pod Template from kubernetes with 1 executors. Remaining excess workload: 0
2020-02-06 17:21:46.798+0000 [id=961]   INFO    o.c.j.p.k.KubernetesLauncher#launch: Created Pod: test/kubernetes-9sp9x
2020-02-06 17:21:46.815+0000 [id=30]    INFO    hudson.slaves.NodeProvisioner#lambda$update$6: Kubernetes Pod Template provisioning successfully completed. We have now 2 computer(s)
2020-02-06 17:21:46.860+0000 [id=968]   INFO    o.internal.platform.Platform#log: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
2020-02-06 17:21:46.863+0000 [id=968]   WARNING i.f.k.c.d.i.WatchConnectionManager$1#onFailure: Exec Failure: HTTP 403, Status: 403 -
java.net.ProtocolException: Expected HTTP 101 response but was '403 Forbidden'
    at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:229)
    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:196)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
2020-02-06 17:21:46.864+0000 [id=961]   WARNING o.c.j.p.k.KubernetesLauncher#launch: Error in provisioning; agent=KubernetesSlave name: kubernetes-9sp9x, template=PodTemplate{inheritFrom='', name='kubernetes', namespace='', label='kubernetes', serviceAccount='default', nodeSelector='', nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], volumes=[HostPathVolume [mountPath=/var/run/docker.sock, hostPath=/var/run/docker.sock]], containers=[ContainerTemplate{name='jnlp', image='joao29a/jnlp-slave-alpine-docker', workingDir='/home/jenkins/', command='', args='', ttyEnabled=true, resourceRequestCpu='', resourceRequestMemory='', resourceLimitCpu='', resourceLimitMemory='', envVars=[KeyValueEnvVar [getValue()=http://x.x.x.x:8080, getKey()=JENKINS_URL]], livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@de43a86}]}
io.fabric8.kubernetes.client.KubernetesClientException:
    at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager$1.onFailure(WatchConnectionManager.java:198)
    at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.java:571)
    at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:198)
    at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
    at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
2020-02-06 17:21:46.865+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#_terminate: Terminating Kubernetes instance for agent kubernetes-9sp9x
2020-02-06 17:21:46.899+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#deleteSlavePod: Terminated Kubernetes instance for agent test/kubernetes-9sp9x
Terminated Kubernetes instance for agent test/kubernetes-9sp9x
2020-02-06 17:21:46.900+0000 [id=961]   INFO    o.c.j.p.k.KubernetesSlave#_terminate: Disconnected computer kubernetes-9sp9x
Disconnected computer kubernetes-9sp9x

答案1

已更新至最新的 kubernetes 插件(版本 1.23.2)并且现在可以正常工作

相关内容