问题是什么基于以下配置,我执行了2个测试用例:
1.我使用我指定的图像,有2个容器将在同一个pod中创建,包括我的定义容器,jenkins kubernetes插件将自动创建一个JNLP容器,但实际命令在JNLP容器中运行,而不是在我指定的容器中。
1.我尝试扩展jnlp-slave映像(从office站点获取),kubenetes插件页面中的容器名称为“jnlp”(图像是由office docker文件“https://hub.docker.com/r/jenkins/jnlp-slave/~/dockerfile/“构建的),我首先让基本jenkins/slave图像工作良好,然后尝试根据需要扩展它。但当我尝试使用默认图像时,它总是提示“等待代理连接(1/100)“,似乎是等待JNLP客户端连接,我进入由jenkins 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
我所做的:
- Kubernetes集群运行良好
- Jenkins主服务器独立于Kubernetes群集。
- Jenkins kubernetes插件成功获取kubernetes证书和连接测试。
1.添加了带有POD标记的kubernetes云。
1.通过“限制此项目可以运行的位置”将标签与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条答案
按热度按时间tgabmvqs1#
通过以下措施修复了问题:
1.在kubernetes插件中将容器名称重命名为
jnlp
。1.在映像
ENTRYPOINT
中正确配置JNLP1.在pod详细信息部分中,将命令保留为运行,将参数保留为传递给命令的空参数。