我有一个在部署时创建的,带有jenkins master和jenkins slave的kubernetes pods安装程序。
我的从属进程无法连接到主进程。我尝试将jenkins网址配置为使用端口的服务名称,使用端口配置服务ip地址,但是两者均无效。
我的服务如下:
jenkins1 LoadBalancer 100.70.213.156 a1a3cd39dfe7011eaacd202be15828c0-1501075918.eu-west-1.elb.amazonaws.com 80:30416/TCP,50000:32699/TCP 1h
我在从属Pod中看到的错误是
SEVERE: Failed to connect to http://jenkins.infrastructure.svc.cluster.local:8080/tcpSlaveAgentListener/: jenkins.infrastructure.svc.cluster.local
java.io.IOException: Failed to connect to http://jenkins.infrastructure.svc.cluster.local:8080/tcpSlaveAgentListener/: jenkins.infrastructure.svc.cluster.local
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:217)
at hudson.remoting.Engine.innerRun(Engine.java:693)
at hudson.remoting.Engine.run(Engine.java:518)
Caused by: java.net.UnknownHostException: jenkins.infrastructure.svc.cluster.local
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:214)
... 2 more
这是我的服务配置
# Please edit the object below. Lines beginning with a ‘#’ will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: Service
metadata:
creationTimestamp: 2020-09-24T14:13:21Z
name: jenkins1
namespace: infrastructure
resourceVersion: “160204667”
selfLink: /api/v1/namespaces/infrastructure/services/jenkins1
uid: 1a3cd39d-fe70-11ea-acd2-02be15828c0e
spec:
clusterIP: 100.70.213.156
externalTrafficPolicy: Cluster
ports:
- name: jenkins-master
nodePort: 30416
port: 80
protocol: TCP
targetPort: 8080
- name: jenkins-jnlp
nodePort: 32699
port: 50000
protocol: TCP
targetPort: 50000
selector:
app: jenkins
sessionAffinity: None
type: LoadBalancer
status:
loadBalancer:
ingress:
- hostname: a1a3cd39dfe7011eaacd202be15828c0-1501075918.eu-west-1.elb.amazonaws.com