我有一台 ubuntu 服务器,其中包含:
Jenkins 能够与 kubernetes 集群通信并创建新的 jenkins 代理 pod。
但是 jenkins 代理不能与 jenkins master 通信。代理应通过 nginx 服务进行通信以到达 jenkins master。
INFO: Locating server among [https://URL/bot/]
Feb 03, 2021 5:52:07 PM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to https://URL/bot/tcpSlaveAgentListener/: URL
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:217)
location /bot/ {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443;
}
sudo docker run --network="host" --detach--env JENKINS_OPTS="--prefix=/bot" jenkins/jenkins
配置云:
connection test: Connected to Kubernetes v1.20.1-34+e7db93d188d0d1
云配置:
jenkins URL: https:// URL /bot
jenkins tunnel: http:// URL :50000
pod 模板:
docker image: jenkins/inbound-agent
working directory: /home/jenkins
command to run: /bin/sh -c
arguments to pass to the command: cat
pod 环境变量:
key: JENKINS_URL, value: https:// URL /bot
key: JENKINS_TUNNEL, value: http:// URL :50000/
安全设置
TCP port for inbound agents 50000 (fixed)
Inbound TCP Agent Protocol/4 (TLS encryption) (checked)
当我请求 http:// URL 时的反馈:50000
Jenkins-Agent-Protocols: JNLP4-connect, Ping
Jenkins-Version: 2.277
Jenkins-Session: a1e872fc
Client: XX.XX.XX.XXX
Server: XX.XX.XXX.XXX
Remoting-Minimum-Version: 3.14
我的猜测是 nginx 配置不当,这就是 kubernetes pod 中的代理无法访问 jenkins 的原因。我希望提供的所有信息足以让您更好地了解问题。
感谢您的帮助