Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-70387

Kubernetes plugin Received fatal alert: handshake_failure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • kubernetes-plugin
    • None

      Hello,
      I am running Jenkins inside k8s cluster(1.25.5) with CRI-O and ingress-nginx deployed by kubespray and it is installed by this helm chart: https://github.com/jenkinsci/helm-charts

      I installed the latest Kubernetes plugin but I can't connect to Kubernetes cluster. I am getting this error:

      Error testing connection https://kubernetes.default.svc.cluster.local: java.io.IOException: Received fatal alert: handshake_failure

      I tried to make diagnose so I enabled ssl handshake debug in Jenkins and getting these values:

      2023-01-10 21:13:35.151+0000 [id=22]    INFO    hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running
      2023-01-10 21:13:52.768+0000 [id=15]    INFO    i.j.p.casc.TokenReloadAction#doIndex: Configuration reload triggered via token
      2023-01-10 21:13:52.788+0000 [id=15]    WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class org.csanchez.jenkins.plugins.kubernetes.PodTemplate#listener: type is abstract but not Describable.
      2023-01-10 21:13:52.806+0000 [id=15]    WARNING i.j.p.c.SecretSourceResolver$UnresolvedLookup#lookup: Configuration import: Found unresolved variable 'chart-admin-username'. Will default to empty string
      2023-01-10 21:13:52.806+0000 [id=15]    WARNING i.j.p.c.SecretSourceResolver$UnresolvedLookup#lookup: Configuration import: Found unresolved variable 'chart-admin-password'. Will default to empty string
      javax.net.ssl|DEBUG|03|Finalizer|2023-01-10 22:13:53.046 CET|SSLSocketImpl.java:578|duplex close of SSLSocket
      javax.net.ssl|DEBUG|03|Finalizer|2023-01-10 22:13:53.046 CET|SSLSocketImpl.java:1755|close the SSL connection (passive)
      javax.net.ssl|DEBUG|03|Finalizer|2023-01-10 22:13:53.047 CET|SSLSocketImpl.java:578|duplex close of SSLSocket
      javax.net.ssl|DEBUG|03|Finalizer|2023-01-10 22:13:53.047 CET|SSLSocketImpl.java:1755|close the SSL connection (passive)
      2023-01-10 21:13:53.069+0000 [id=15]    WARNING i.j.p.casc.BaseConfigurator#createAttribute: Can't handle class org.csanchez.jenkins.plugins.kubernetes.PodTemplate#listener: type is abstract but not Describable.
      2023-01-10 21:13:53.081+0000 [id=15]    WARNING i.j.p.c.SecretSourceResolver$UnresolvedLookup#lookup: Configuration import: Found unresolved variable 'chart-admin-username'. Will default to empty string
      2023-01-10 21:13:53.082+0000 [id=15]    WARNING i.j.p.c.SecretSourceResolver$UnresolvedLookup#lookup: Configuration import: Found unresolved variable 'chart-admin-password'. Will default to empty string
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.804 CET|SupportedGroupsExtension.java:382|Ignore inactive or disabled named group: ffdhe2048
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.804 CET|SupportedGroupsExtension.java:382|Ignore inactive or disabled named group: ffdhe3072
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.804 CET|SupportedGroupsExtension.java:382|Ignore inactive or disabled named group: ffdhe4096
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.804 CET|SupportedGroupsExtension.java:382|Ignore inactive or disabled named group: ffdhe6144
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.805 CET|SupportedGroupsExtension.java:382|Ignore inactive or disabled named group: ffdhe8192
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.814 CET|ClientHello.java:642|Produced ClientHello handshake message (
      "ClientHello": {
        "client version"      : "TLSv1.2",
        "random"              : "2D 55 2C B2 EF AA C5 74 FB 92 0F 02 3F 15 E7 B7 B9 4E 0E 96 94 10 F5 03 A9 EC E9 FB 9A A2 55 93",
        "session id"          : "",
        "cipher suites"       : "[TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(0xC02C), TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(0xC02B), TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(0xCCA9), TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(0xC030), TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256(0xCCA8), TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(0xC02F), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(0xC014), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(0xC013), TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D), TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C), TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F)]",
        "compression methods" : "00",
        "extensions"          : [
          "server_name (0)": {
            type=host_name (0), value=kubernetes.default
          },
          "status_request (5)": {
            "certificate status type": ocsp
            "OCSP status request": {
              "responder_id": <empty>
              "request extensions": {
                <empty>
              }
            }
          },
          "supported_groups (10)": {
            "versions": [x25519, secp256r1, secp384r1, secp521r1, x448]
          },
          "ec_point_formats (11)": {
            "formats": [uncompressed]
          },
          "signature_algorithms (13)": {
            "signature schemes": [ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512, ecdsa_sha224, rsa_sha224]
          },
          "signature_algorithms_cert (50)": {
            "signature schemes": [ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, ecdsa_secp521r1_sha512, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512, rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, rsa_pkcs1_sha256, rsa_pkcs1_sha384, rsa_pkcs1_sha512, ecdsa_sha224, rsa_sha224]
          },
          "application_layer_protocol_negotiation (16)": {
            [h2, http/1.1]
          },
          "status_request_v2 (17)": {
            "cert status request": {
              "certificate status type": ocsp_multi
              "OCSP status request": {
                "responder_id": <empty>
                "request extensions": {
                  <empty>
                }
              }
            }
          },
          "extended_master_secret (23)": {
            <empty>
          },
          "supported_versions (43)": {
            "versions": [TLSv1.2]
          },
          "renegotiation_info (65,281)": {
            "renegotiated connection": [<no renegotiated connection>]
          }
        ]
      }
      )
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.816 CET|Alert.java:238|Received alert message (
      "Alert": {
        "level"      : "fatal",
        "description": "handshake_failure"
      }
      )
      javax.net.ssl|ERROR|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.817 CET|TransportContext.java:345|Fatal (HANDSHAKE_FAILURE): Received fatal alert: handshake_failure (
      "throwable" : {
        javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
              at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
              at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
              at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:340)
              at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:293)
              at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:186)
              at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172)
              at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1506)
              at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1416)
              at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:456)
              at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:427)
              at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:320)
              at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:284)
              at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:169)
              at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:258)
              at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
              at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
              at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
              at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
              at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
              at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:127)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
              at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
              at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:257)
              at okhttp3.RealCall$AsyncCall.execute(RealCall.java:201)
              at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
              at java.base/java.lang.Thread.run(Thread.java:829)})
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.817 CET|SSLSocketImpl.java:1736|close the underlying socket
      javax.net.ssl|DEBUG|46|OkHttp https://kubernetes.default/...|2023-01-10 22:14:54.818 CET|SSLSocketImpl.java:1755|close the SSL connection (initiative)

      Also when I tried this command

      openssl s_client -connect kubernetes.default.svc.cluster.local:443 

      I am getting this:

      CONNECTED(00000003)
      depth=0 CN = kube-apiserver
      verify error:num=20:unable to get local issuer certificate
      verify return:1
      depth=0 CN = kube-apiserver
      verify error:num=21:unable to verify the first certificate
      verify return:1
      depth=0 CN = kube-apiserver
      verify return:1
      ---
      Certificate chain
       0 s:CN = kube-apiserver
         i:CN = kubernetes
         a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
         v:NotBefore: Jan 10 09:15:19 2023 GMT; NotAfter: Jan 10 09:15:19 2024 GMT
      ---
      Server certificate
      -----BEGIN CERTIFICATE-----
      
      -----END CERTIFICATE-----
      subject=CN = kube-apiserver
      issuer=CN = kubernetes
      ---
      Acceptable client certificate CA names
      CN = kubernetes
      CN = front-proxy-ca
      Requested Signature Algorithms: RSA-PSS+SHA256:ECDSA+SHA256:Ed25519:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA+SHA256:RSA+SHA384:RSA+SHA512:ECDSA+SHA384:ECDSA+SHA512:0x01+0x02:0x03+0x02
      Shared Requested Signature Algorithms: RSA-PSS+SHA256:ECDSA+SHA256:Ed25519:RSA-PSS+SHA384:RSA-PSS+SHA512:RSA+SHA256:RSA+SHA384:RSA+SHA512:ECDSA+SHA384:ECDSA+SHA512
      Peer signing digest: SHA256
      Peer signature type: RSA-PSS
      Server Temp Key: X25519, 253 bits
      ---
      SSL handshake has read 1679 bytes and written 434 bytes
      Verification error: unable to verify the first certificate
      ---
      New, TLSv1.3, Cipher is TLS_AES_128_GCM_SHA256
      Server public key is 2048 bit
      Secure Renegotiation IS NOT supported
      Compression: NONE
      Expansion: NONE
      No ALPN negotiated
      Early data was not sent
      Verify return code: 21 (unable to verify the first certificate)
      ---
      ---
      Post-Handshake New Session Ticket arrived:
      SSL-Session:
          Protocol  : TLSv1.3
          Cipher    : TLS_AES_128_GCM_SHA256
          Session-ID: 2B196EF574DB0B28F562DAC965D1E13AF83CDF43B1CFF4030147EC9E6B11F144
          Session-ID-ctx:
          Resumption PSK: 1555D7C6C51DBC2717159C9A9B37B01F72A6E1BEB8046EAD200BB619556C8BAA
          PSK identity: None
          PSK identity hint: None
          SRP username: None
          TLS session ticket lifetime hint: 604800 (seconds)
          TLS session ticket:
          0000 - c4 05 7d bc 6c d8 7a 3e-7b 8c 33 55 13 85 c3 53   ..}.l.z>{.3U...S
          0010 - 46 69 ca 15 13 32 08 06-f0 bf 34 ff 6d 1e 4b c3   Fi...2....4.m.K.
          0020 - d4 dd 83 2c 44 7d b4 f8-9f 4b 76 3f 52 76 4f 0f   ...,D}...Kv?RvO.
          0030 - 78 2d 78 cb 8e 6e a8 a6-fc 33 29 6e cc e3 d9 af   x-x..n...3)n....
          0040 - a6 c3 13 e3 0b 6b 63 35-af 99 f4 1b c0 8a 7f 99   .....kc5........
          0050 - 97 68 65 23 c1 99 9f 19-c0 12 82 54 4f 7b e1 a3   .he#.......TO{..
          0060 - 3e c5 73 c7 4f 98 b6 24-18 b2 f8 ea 4c f1 7c e4   >.s.O..$....L.|.
          0070 - 6c                                                l    Start Time: 1673385625
          Timeout   : 7200 (sec)
          Verify return code: 21 (unable to verify the first certificate)
          Extended master secret: no
          Max Early Data: 0
      ---
      read R BLOCK
      closed 

      Also I tried to add this and it didn't help me:

      -Djdk.tls.client.protocols=TLSv1.2 

      Could you help me, please?

       

      Thanks in advance.

            Unassigned Unassigned
            martin684 Martin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: