Java Kubernetes client SSLHandshakeException extension (5) should not be presented in certificate_request

3/21/2020

I am getting "extension (5) should not be presented in certificate_request" when trying to run locally a Java Kubernetes client application which queries the Kubernetes cluster over a lube proxy connection. Any thoughts? Thanks in advance

  ApiClient client = null;
    try {
        client = Config.defaultClient();
        //client.setVerifyingSsl(false);
    } catch (IOException e) {
        e.printStackTrace();
    }
    Configuration.setDefaultApiClient(client);

    CoreV1Api api = new CoreV1Api();
    V1PodList list = null;
    try {
        list = api.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null);
    } catch (ApiException e) {
        e.printStackTrace();
    }
    for (V1Pod item : list.getItems()) {
        System.out.println(item.getMetadata().getName());
    }
-- Alexander F
java
kubernetes

2 Answers

4/10/2020

Which version of Java are you using?

JDK 11 onwards have support for TLS 1.3 which can cause the error extension (5) should not be presented in certificate_request.

Add -Djdk.tls.client.protocols=TLSv1.2 to the JVM args to make it use 1.2 instead.

There is an issue on Go lang relating to this https://github.com/golang/go/issues/35722 and someone there also posted to disable TLS 1.3 on the Java side

-- zcourts
Source: StackOverflow

3/21/2020

Instead of connecting via kubectl proxy connect to Kubernetes API Server directly from the application by providing a kubeconfig file to the Java client.

-- Arghya Sadhu
Source: StackOverflow