Kubernetes插件容器无法连接回Jenkins [英] Kubernetes plugin containers can't connect back to Jenkins

查看:947
本文介绍了Kubernetes插件容器无法连接回Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Jenkins和Kubernetes集群在AWS的同一个网络中运行。 Jenkins有自己的实例。



我已经配置了Kubernetes插件,如下所示:



使用推荐的JNLP泊坞窗图像。 Jenkins JNLP端口配置为静态 5000



现在,当我开始工作时,它显示了节点离线。当我点击离线节点时,我得到:





这使我进入k8群集。运行 docker ps 不显示运行的容器。但是:





从那里我去找什么码头容器运行,之后留下什么记录:





我使用:

解决方案

目录不可写邮件在容器日志?

  [...] 
线程mainjava中的异常。 lang.RuntimeException:根目录不可写
在hudson.remoting.FileSystemJarCache。< init>(FileSystemJarCache.java:44)
在hudson.remoting.Engine。< init>(Engine.java: 139)
at hudson.remoting.jnlp.Main.createEngine(Main.java:164)
at hudson.remoting.jnlp.Main.main(Main.java:148)
at hudson .remoting.jnlp.Main._main(Main.java:144)
at hudson.remoting.jnlp.Main.main(Main.java:110)

在这种情况下,您可能会遇到类似于这个



PS:如果看不到日志,请尝试删除分配伪造选项


I have a Jenkins and Kubernetes cluster running within the same network in AWS. Jenkins has it's own instance.

I have configured the Kubernetes plugin as follows:

The recommended JNLP docker image is used. Jenkins JNLP port is configured to be static 5000.

Now when I kick off the job, it shows me that the node is offline. When I click on the offline node I get this:

This makes me go to the k8 cluster. Running docker ps shows no containers running. However:

From there I go to find what docker container gets run and what logs it leaves after that:

I use: https://github.com/jenkinsci/docker-jnlp-slave as image

https://github.com/jenkinsci/kubernetes-plugin

Jenkins version: 2.27

k8: hyperkube:v1.4.3_coreos.0

Jenkins does spin up the container, I guess it runs and errors out because no valid arguments are provided during the container run? I need it to be a hands off process where I don't have to log in to my containers (Java clients). How do I achieve this?

UPDATE

Based on this answer: kubernetes slaves cannot register to jenkins master

If I log into the container and run the command that Jenkins displays under the host that cannot connect:

java -jar /usr/share/jenkins/slave.jar -jnlpUrl https://test.myhost.com/computer/jenkinsminions-10f0b7d49054ac/slave-agent.jnlp -secret 62637e83008f50eb94483ad609e9a2719d313fa56e640e4beca9eebeaf0b1af2

The container connects via JNLP2 and the job runs.

I tried to add the arguments as suggested, but no luck. Containers still won't connect automatically:

解决方案

Do you have a Root directory not writable message in the container log?

[...]
Exception in thread "main" java.lang.RuntimeException: Root directory not writable
    at hudson.remoting.FileSystemJarCache.<init>(FileSystemJarCache.java:44)
    at hudson.remoting.Engine.<init>(Engine.java:139)
    at hudson.remoting.jnlp.Main.createEngine(Main.java:164)
    at hudson.remoting.jnlp.Main.main(Main.java:148)
    at hudson.remoting.jnlp.Main._main(Main.java:144)
    at hudson.remoting.jnlp.Main.main(Main.java:110)

In this case, you might have a problem similar to this.

PS: If you cannot see the logs, try removing the "Allocate pseudotty" option

这篇关于Kubernetes插件容器无法连接回Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆