Kubernetes-client: "CLEARTEXT communication not enabled for client" error when connecting to http instances

Created on 21 Aug 2016  路  2Comments  路  Source: fabric8io/kubernetes-client

I have a Kubernetes instance running on http and trying to connect using client version 1.4.4 seems to throw the following stacktrace.

It looks like OkHttp needs the ConnectionSpecs to indicate what type of a connection is this and needs the CLEARTEXT ConnectionSpec setup if we want to make a HTTP connection.

I couldn't find a way to get access to the OkHttp's Client or Request classes from the public API, so wasn't sure how to get past this. If we can somehow introduce OkHttp interceptor or another way in the kubernetes client to get access to the Client/Request classes, this could be solved.

My code is simply this:

        Config config = new ConfigBuilder()
                .withMasterUrl(floatingIp)
                .withNamespace("default")       // Use default namespace
                .build();
        KubernetesClient client = new DefaultKubernetesClient(config);

        Service service = client.services().withName(serviceName).get();

Any ideas?

Stacktrace:

Caused by: java.net.UnknownServiceException: CLEARTEXT communication not enabled for client at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:98) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) at okhttp3.RealCall.execute(RealCall.java:60) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:234) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:229) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleGet(OperationSupport.java:225) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleGet(BaseOperation.java:559) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.get(BaseOperation.java:134)```

Most helpful comment

.connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT))

All 2 comments

Sorry about this. It was reported last week but I was out on vacation - will try to fix up this week.

.connectionSpecs(Arrays.asList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT))

Was this page helpful?
0 / 5 - 0 ratings