Kubernetes 在 运行 管道之前终止 jenkins slaves

Kubernetes terminates jenkins slaves before running the pipeline

我用一个 Jenkins 实例配置了一个本地 K8s 集群,我的想法是它将 运行 该集群中的从属节点。我在 Jenkins 中配置了 K8s 插件,并放置了一个 pod/container 用于使用默认的 Jenkins 从属进行测试,但是,K8s 似乎甚至在 运行 连接管道之前就杀死了 pod。有没有人通过这个来帮助?

May 21, 2022 3:18:05 PM INFO hudson.slaves.NodeProvisioner update
kube-agent-px18m provisioning successfully completed. We have now 2 computer(s)
May 21, 2022 3:18:05 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
Created Pod: kubernetes jenkins/kube-agent-px18m
May 21, 2022 3:18:07 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
Pod is running: kubernetes jenkins/kube-agent-px18m
May 21, 2022 3:18:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.pod.retention.Reaper$TerminateAgentOnContainerTerminated lambda$onEvent
jenkins/kube-agent-px18m Container jnlp was just terminated, so removing the corresponding Jenkins agent
May 21, 2022 3:18:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Terminating Kubernetes instance for agent kube-agent-px18m
May 21, 2022 3:18:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave deleteSlavePod
Terminated Kubernetes instance for agent jenkins/kube-agent-px18m
May 21, 2022 3:18:17 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
Disconnected computer kube-agent-px18m
May 21, 2022 3:18:17 PM WARNING org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
Error in provisioning; agent=KubernetesSlave name: kube-agent-px18m, template=PodTemplate{id='d3170ee8-ea06-474e-8e52-a2275d90346a', name='kube-agent', namespace='jenkins', idleMinutes=5, label='kubeagent', containers=[ContainerTemplate{name='jnlp', image='jenkins/jnlp-slave', workingDir='/home/jenkins', command='', args='', resourceRequestCpu='', resourceRequestMemory='', resourceRequestEphemeralStorage='', resourceLimitCpu='', resourceLimitMemory='', resourceLimitEphemeralStorage='', livenessProbe=ContainerLivenessProbe{execArgs='', timeoutSeconds=0, initialDelaySeconds=0, failureThreshold=0, periodSeconds=0, successThreshold=0}}]}
java.lang.IllegalStateException: Node was deleted, computer is null
    at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:193)
    at hudson.slaves.SlaveComputer.lambda$_connect[=11=](SlaveComputer.java:298)
    at jenkins.util.ContextResettingExecutorService.call(ContextResettingExecutorService.java:46)
    at jenkins.security.ImpersonatingExecutorService.call(ImpersonatingExecutorService.java:80)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

作业正在等待执行器,K8s 正在循环创建新的从 pod 并终止它。

问题已解决。我忘了在Kubernetes中打开50000端口,让master和slave可以通信