jenkins上的报错该slave一直处于脱机的状态,于是去检查日志

kubectl logs -f ceshi-14-r3n1k-2fbcn-jpbf2 -n jenkins

结果报错如下:

Dec 28, 2023 2:14:27 AM hudson.remoting.Launcher$CuiListener status
INFO: Could not locate server among [http://10.211.55.6:32000/]; waiting 10 seconds before retry
java.io.IOException: http://10.211.55.6:32000/ provided port:50000 is not reachable on host 10.211.55.6
        at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:304)
        at hudson.remoting.Engine.innerRun(Engine.java:809)
        at hudson.remoting.Engine.run(Engine.java:563)

这表明 Jenkins Agent 尝试连接到地址

http://10.211.55.6:32000/,但是指定的端口

50000 在该主机上不可达。

最后找到原因了,我启动jenkins的service时没有吧50000端口代理出来。。。

更改service.yaml在重新启动

apiVersion: v1
kind: Service
metadata:
  name: jenkins
  namespace: jenkins
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/path:   /
      prometheus.io/port:   '8080'
spec:
  selector:
    app: jenkins
  type: NodePort
  ports:
    - name: http
      port: 8080
      targetPort: 8080
      nodePort: 32000
    - name: agent
      port: 50000
      protocol: TCP

更多推荐