Kubernetes Jenkins插件 - 奴隶总是离线

phi*_*son 7 jenkins docker kubernetes

我正在尝试使用Jenkins/Kubernetes插件与Jenkins协调docker奴隶.

我正在使用这个插件:https: //github.com/jenkinsci/kubernetes-plugin

我的问题是所有从站都处于脱机状态,因此作业无法执行:

奴隶状态

在此输入图像描述

我在使用minikube的本地盒子上以及由我们的ops组托管的K8群集上尝试了这个.我已经尝试了Jenkins 1.9和Jenkins 2.我总是得到相同的结果.屏幕截图来自Jenkins 1.642.4,K8 v1.2.0

这是我的配置...请注意,当我点击"测试连接"时,我获得了成功.另请注意,我不需要任何凭据(这是我可以看到的唯一区别与记录的示例).

詹金斯系统配置

Jenkins日志反复显示以下内容:

    Waiting for slave to connect (11/100): docker-6b55f1b7fafce
Jul 20, 2016 5:01:06 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback call
Waiting for slave to connect (12/100): docker-6b55f1b7fafce
Jul 20, 2016 5:01:07 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback call
Waiting for slave to connect (13/100): docker-6b55f1b7fafce
Jul 20, 2016 5:01:08 PM INFO org.csanchez.jenkins.plugins.kubernetes.KubernetesCloud$ProvisioningCallback call
Run Code Online (Sandbox Code Playgroud)

我跑的时候kubectl get events看到这个:

24s         24s        1         docker-6b3c2ff27dad3   Pod                                Normal    Scheduled           {default-scheduler }      Successfully assigned docker-6b3c2ff27dad3 to 96.xxx.xx.159
24s         23s        2         docker-6b3c2ff27dad3   Pod                                Warning   MissingClusterDNS   {kubelet 96.xxx.xx.159}   kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
23s         23s        1         docker-6b3c2ff27dad3   Pod       spec.containers{slave}   Normal    Pulled              {kubelet 96.xxx.xx.159}   Container image "jenkinsci/jnlp-slave" already present on machine
23s         23s        1         docker-6b3c2ff27dad3   Pod       spec.containers{slave}   Normal    Created             {kubelet 96.xxx.xx.159}   Created container with docker id 82fcf1bd0328
23s         23s        1         docker-6b3c2ff27dad3   Pod       spec.containers{slave}   Normal    Started             {kubelet 96.xxx.xx.159}   Started container with docker id 82fcf1bd0328
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

更新:csanchez建议的更多日志信息

 ?  docker git:(master) ? kubectl get pods --namespace default -o wide
NAME                   READY     STATUS    RESTARTS   AGE       NODE
docker-6bb647254a2a4   1/1       Running   0          1m        96.x.x.159

?  docker git:(master) ? kubectl log docker-6bafbac10b392

    Jul 20, 2016 6:45:10 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to 96.x.x.159:50000 (retrying:10)
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
Run Code Online (Sandbox Code Playgroud)

我将不得不看看这个端口50000用于什么?

csa*_*hez 2

您需要公开端口 8080 和 50000,如插件示例配置中所述https://github.com/jenkinsci/kubernetes-plugin/blob/master/src/main/kubernetes/jenkins.yml