jenkins kubernetes插件-等待代理连接(1/100)

时间:2018-09-03 17:07:23

标签: jenkins kubernetes jenkins-plugins

出什么问题 根据以下配置,我做了2个测试用例:

  1. 我使用我的指定图像,将在同一容器中创建2个容器,包括我的define容器,jenkins kubernetes插件将自动创建JNLP容器,但实际命令在JNLP容器中运行,而不是在我指定的容器中运行。
  2. 我尝试扩展jnlp-slave映像(从Office站点获取),在kubenetes插件页面中,容器名称为“ jnlp”(映像由Office docker文件“ https://hub.docker.com/r/jenkins/jnlp-slave/~/dockerfile/”构建),我首先让基本的詹金斯/奴隶形象运作良好,然后尝试根据需要扩展它。 但是当我尝试使用默认值时,它总是提示“等待代理连接(1/100)”,似乎在等待JNLP客户端连接,我输入了由詹金斯kubernetes插件创建的动态图像,我发现没有任何与“ ENTRYPOINT [“ jenkins-slave”]“的过程相关,我检查了jenkins日志,提示信息如下。任何提示都会很高兴。

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

我所做的事情:

  1. Kubernetes集群运行良好
  2. Jenkins主服务器独立于Kubernetes集群。
  3. Jenkins kubernetes插件成功获得kubernetes凭据和连接测试。
  4. 添加了带有标签POD的kubernetes云。
  5. 通过“限制可以在哪里运行该项目”将标签与Jenkins的任务组合在一起

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"]

如何触发工作:

Jenkins通过curl命令触发作业(不在管道中),jenkins kubernetes插件可以使用我定义的图像触发作业。

1 个答案:

答案 0 :(得分:0)

问题已通过以下操作解决:

  1. 在kubernetes插件中将容器名称重命名为jnlp。

  2. 保持图像中正确配置的JNLP ENTRYPOINT 来自特定图片
    (复制詹金斯奴隶/ usr / local / bin / jenkins-slave ENTRYPOINT [“ jenkins-slave”])

  3. 让“要运行的命令”和传递给该命令的参数为空。