问题描述
我有一个kubernetes集群(托管在大学中,不在gcloud中),并且我试图将Jenkins与jenksci/kubernetes插件一起使用来启动从属服务器.但是,无论我做什么,他们似乎都无法向大师注册. (k8s 1.2,jenkins 2.19.2,kub-plugin 0.9)
I have a kubernetes cluster (hosted at the university, not in gcloud) and I'm trying to use Jenkins with the jenksci/kubernetes plugin to launch the slaves. However, it seems they cannot register to the master, no matter what I do. (k8s 1.2, jenkins 2.19.2, kub-plugin 0.9)
这是我使用的配置:
现在:
-
如果我将tty:true设置为容器启动,但将永远无法连接到主服务器.日志不可读,我无法附加到从属服务器来检查正在发生的事情:
If I set tty:true the container starts but is never able to connect to the master. The logs are unreadable and I cannot attach to the slave to inspect what is happening:
$ kubectl logs jnpl-slave-ec16b9ae7bbd --namespace=jenkins
Error from server: Unrecognized input header
$ kubectl attach -ti jnpl-slave-ec16b9ae7bbd --namespace=jenkins
error: pod jnpl-slave-ec16b9ae7bbd is not running and cannot be attached to; current phase is Succeeded
如果我设置tty:false,容器将启动并正确执行入口点/usr/local/bin/jenkins-slave,但是似乎未传递密码和slaveName命令行参数,因为流程模具要求他们:
If I set tty:false the container starts and correctly executes the entrypoint /usr/local/bin/jenkins-slave, but it seems that the secret and the slaveName command-line args are not passed, as the process dies asking for them:
$ kubectl logs jnpl-slave-ecfd3a6cbaba --namespace=jenkins
Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
two arguments required, but got []
...
如果我手动将参数(种子和从属名称)设置为假值,则它可以正确启动,但随后因抱怨/home/jenkins不可写而死:
If I manually set the parameters (seed and the slave name) to a fake value, it starts correctly, but then dies complaining that /home/jenkins is not writable:
Warning: JnlpProtocol3 is disabled by default, use JNLP_PROTOCOL_OPTS to alter the behavior
hudson.remoting.jnlp.Main createEngine
Setting up slave: http://10.254.151.87
hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Exception in thread "main" java.lang.RuntimeException: Root directory not writable
...
但是,如果我在网页上手动创建了一个从站,它就可以工作,并且我可以在线看到该从站:
However, if I create a slave manually on the webpage setup it, it works and I can see the slave online:
node$ sudo docker run -ti docker.io/jenkinsci/jnlp-slave:latest /bin/bash
pod$ java -jar /usr/share/jenkins/slave.jar -jnlpUrl http://10.254.151.87/computer/slave1/slave-agent.jnlp
...
INFO: Connected
所以...我不知道要进一步测试什么.如果有人可以给我提示,我将不胜感激!
So... I don't know what to test further. I would really appreciate if someone could give me an hint!
最诚挚的问候,
马里奥(Mario)
推荐答案
当将新容器添加到Pod定义时,arguments字段应为${computer.jnlpmac} ${computer.name}
,并且默认情况下应将其设置为
The arguments field should be ${computer.jnlpmac} ${computer.name}
and should be set by default when adding new containers to the Pod definition
这篇关于kubernetes奴隶无法注册到詹金斯大师的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!