Jenkins奴隶不能用Kubernetes交流,有什么问题吗?

eoigrqb6  于 2023-03-12  发布在  Kubernetes
关注(0)|答案(1)|浏览(144)

我尝试使用Jenkins Kubernetes插件在Kubernetes集群内创建Jenkins代理作为动态POD。在Jenkins配置中,已确认它与Kubernetes通信连接。但是,在执行构建测试时发生JNLP错误。
enter image description hereenter image description here

NAME              TYPE       CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
jenkins-service   NodePort   10.233.35.35   <none>        8080:32000/TCP   137m
pipeline {
    agent {
        kubernetes {
            yaml '''
                apiVersion: v1
                kind: Pod
                spec:
                  containers:
                  - name: maven
                    image: maven:alpine
                    command:
                    - cat
                    tty: true
            '''
        }
    }
    stages {
        stage('Run Maven'){
            steps {
                container('maven'){
                    sh 'mvn -version'
                }
            }
        }
    }
}
Created Pod: kubernetes jenkins/test-9-0xmxv-knlhg-359ck
jenkins/test-9-0xmxv-knlhg-359ck Container jnlp was terminated (Exit Code: 255, Reason: Error)

- jnlp -- terminated (255)
-----Logs-------------
Dec 27, 2022 7:52:39 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Dec 27, 2022 7:52:39 AM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.11
Dec 27, 2022 7:52:39 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/jenkins/agent/remoting as a remoting work directory
Dec 27, 2022 7:52:39 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Dec 27, 2022 7:52:39 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [https://10.233.35.35:8080/]
Dec 27, 2022 7:52:39 AM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: Failed to connect to https://10.233.35.35:8080/tcpSlaveAgentListener/: Unsupported or unrecognized SSL message
java.io.IOException: Failed to connect to https://10.233.35.35:8080/tcpSlaveAgentListener/: Unsupported or unrecognized SSL message
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:214)
    at hudson.remoting.Engine.innerRun(Engine.java:724)
    at hudson.remoting.Engine.run(Engine.java:540)
Caused by: javax.net.ssl.SSLException: Unsupported or unrecognized SSL message
    at java.base/sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketInputRecord.decode(Unknown Source)
    at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)
    at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:211)
    ... 2 more
rkue9o1l

rkue9o1l1#

Jenkins配置中,您提供了Jenkins URL = https://10.233.35.35:8080,在我看来应该是http://jenkins-service.<<jenkins namespace>>.svc.cluster.local:8080。请注意,k8s默认情况下在pod之间使用未加密的流量,并且此配置指向https端点,这不是有效的协议。

相关问题