java: javax.net.ssl.SSLHandshakeException

Hello everyone,

I 've been trying to use the API, but I get the following error:

Screenshot

I have this issue while just trying to do the following:

ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
CoreV1Api apiInstance = new CoreV1Api();
        // get namespace list as a result
        V1NamespaceList v1NamespaceList = apiInstance.listNamespace(null, null, null, null, null, null, null, null, null);
        // add namespace names to a list
        return v1NamespaceList
                .getItems()
                .stream()
                .map(v1Namespace -> v1Namespace.getMetadata().getName())
                .collect(Collectors.toList());

I suspect the error lies on those lines:

ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);

During my efforts, I have tried to use Java 8, Java 11 and Java 13 and nothing changed.

Any help would be very important.

Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (9 by maintainers)

Most upvoted comments

I ran into this issue. Try adding this to the JVM settings:

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

Using k3s with OpenJDK 13 and client-java 8.0.0

@rjeberhard Hello, I have found a solution adding this -Djdk.tls.client.protocols=TLSv1.2 as mentioned by @leefaus . It seems strange as I have said before that this solution wasn’t working for me. Well, actually, it seems noobish but I was using a wrong kubeconfig file. For some reason, I had a configuration file under the default path ./kube/config, but the kubernetes distribution I use sets another config file path.

So, please close the issue and I really appreciate everyone’s help!

k8s 1.15 works well with JDK 11.0.6. The issue is just with changes in k8s 1.16+.

OpenJDK 11.0.6 does not work against Kubernetes 1.16. Version 11.0.7 has the necessary fix and is planned available on April 14th.