Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of Config.defaultClient(); is not longer valid in io.kubernetes:client-java-api:21.0.1 #3859

Open
Memo2782 opened this issue Jan 8, 2025 · 2 comments

Comments

@Memo2782
Copy link

Memo2782 commented Jan 8, 2025

Describe the bug
Looks like the references about how Fetch Config.defaultClient(); are not any longer valid from version 19 onward

Client Version
e.g. 21.0.1

Kubernetes Version
e.g. 21.0.1

Java Version
Java 8

To Reproduce
When i execute V1SecretList listSecret = new CoreV1Api(client).listNamespacedSecret(tlsInfo.getSecretsNamespace()
).execute();
when the code goes through the Class CoreV1Api at the section where the code is executed the references are timming out with the following error
{"instant":{"epochSecond":1736370513,"nanoOfSecond":362727400},"thread":"Test worker","level":"ERROR","loggerName":"ocpm.certificatemanagement.service.CertificatesProcessor","message":"API Exception occurred: Message: java.net.ConnectException: Failed to connect to /172.20.169.71:6443\r\nHTTP response code: 0\r\nHTTP response body: null\r\nHTTP response headers: null","thrown":{"commonElementCount":0,"localizedMessage":"Message: java.net.ConnectException: Failed to connect to /172.20.169.71:6443\r\nHTTP response code: 0\r\nHTTP response body: null\r\nHTTP response headers: null","message":"Message: java.net.ConnectException: Failed to connect to /172.20.169.71:6443\r\nHTTP response code: 0\r\nHTTP response body: null\r\nHTTP response headers: null","name":"io.kubernetes.client.openapi.ApiException","cause":{"commonElementCount":51,"localizedMessage":"Failed to connect to /172.20.169.71:6443","message":"Failed to connect to /172.20.169.71:6443","name":"java.net.ConnectException","cause":{"commonElementCount":51,"localizedMessage":"Connection timed out: no further information","message":"Connection timed out: no further information","name":"java.net.ConnectException","extendedStackTrace":"java.net.ConnectException: Connection timed out: no further information\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[?:?]\n\tat java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]\n\tat java.base/java.net.Socket.connect(Socket.java:633) ~[?:?]\n\tat okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[okhttp-4.12.0.jar:?]\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1028) ~[client-java-api-21.0.1.jar:?]\n"},"extendedStackTrace":"java.net.ConnectException: Failed to connect to /172.20.169.71:6443\n\tat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[okhttp-4.12.0.jar:?]\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1028) ~[client-java-api-21.0.1.jar:?]\nCaused by: java.net.ConnectException: Connection timed out: no further information\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[?:?]\n\tat java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]\n\tat java.base/java.net.Socket.connect(Socket.java:633) ~[?:?]\n\tat okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[okhttp-4.12.0.jar:?]\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1028) ~[client-java-api-21.0.1.jar:?]\n\t... 51 more\n"},"extendedStackTrace":"io.kubernetes.client.openapi.ApiException: Message: java.net.ConnectException: Failed to connect to /172.20.169.71:6443\r\nHTTP response code: 0\r\nHTTP response body: null\r\nHTTP response headers: null\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1032) ~[client-java-api-21.0.1.jar:?]\n\tat io.kubernetes.client.openapi.apis.CoreV1Api.listNamespacedSecretWithHttpInfo(CoreV1Api.java:27730) ~[client-java-api-21.0.1.jar:?]\n\tat io.kubernetes.client.openapi.apis.CoreV1Api$APIlistNamespacedSecretRequest.execute(CoreV1Api.java:27897) ~[client-java-api-21.0.1.jar:?]\n\tat ocpm.certificatemanagement.service.CertificatesProcessor.fetchSecrets(CertificatesProcessor.java:311) [main/:?]\n\tat ocpm.certificatemanagement.service.CertificatesProcessor.configureTls2(CertificatesProcessor.java:266) [main/:?]\n\tat ocpm.certificatemanagement.service.CertificatesProcessor.init(CertificatesProcessor.java:45) [main/:?]\n\tat ocpm.certificatemanagement.service.CertificateTest.test_init_ConfigureTLS_SecretNotFound(CertificateTest.java:95) [test/:?]\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]\n\tat org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:61) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.2.jar:4.13.2]\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.2.jar:4.13.2]\n\tat org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:108) [gradle-testing-jvm-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:57) [gradle-testing-jvm-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:39) [gradle-testing-jvm-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62) [gradle-testing-jvm-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52) [gradle-testing-base-7.6.jar:7.6]\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]\n\tat org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) [gradle-messaging-7.6.jar:7.6]\n\tat org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) [gradle-messaging-7.6.jar:7.6]\n\tat org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33) [gradle-messaging-7.6.jar:7.6]\n\tat org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94) [gradle-messaging-7.6.jar:7.6]\n\tat jdk.proxy2/jdk.proxy2.$Proxy5.processTestClass(Unknown Source) [?:?]\n\tat org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176) [gradle-testing-base-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129) [gradle-testing-base-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100) [gradle-testing-base-7.6.jar:7.6]\n\tat org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60) [gradle-testing-base-7.6.jar:7.6]\n\tat org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56) [gradle-worker-processes-7.6.jar:7.6]\n\tat org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113) [gradle-worker-processes-7.6.jar:7.6]\n\tat org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65) [gradle-worker-processes-7.6.jar:7.6]\n\tat worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69) [gradle-worker.jar:?]\n\tat worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74) [gradle-worker.jar:?]\nCaused by: java.net.ConnectException: Failed to connect to /172.20.169.71:6443\n\tat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[okhttp-4.12.0.jar:?]\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1028) ~[client-java-api-21.0.1.jar:?]\n\t... 51 more\nCaused by: java.net.ConnectException: Connection timed out: no further information\n\tat java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[?:?]\n\tat java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[?:?]\n\tat java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[?:?]\n\tat java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?]\n\tat java.base/java.net.Socket.connect(Socket.java:633) ~[?:?]\n\tat okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[okhttp-4.12.0.jar:?]\n\tat okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[okhttp-4.12.0.jar:?]\n\tat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:1028) ~[client-java-api-21.0.1.jar:?]\n\t... 51 more\n"},"endOfBatch":false,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","threadId":1,"threadPriority":5,"messageTimestamp":"2025-01-08T15:08:33.362-0600"}

Expected behavior
The behavir expected is that this code snippet behaves as this code
V1SecretList listSecret = new CoreV1Api(client).listNamespacedSecret(tlsInfo.getSecretsNamespace(), null, null,
null, null, null, null, null, null, null, null); that in the past used to fetch properly all the references

KubeConfig
It dependes of ApiClient references

Server (please complete the following information):

  • OS: [e.g. Linux] ApiClient References
  • Environment [e.g. container] ApiClient References
  • Cloud [e.g. Azure] ApiClient References

Additional context
Please provide documentation how this can be sorted out

@brendandburns
Copy link
Contributor

That looks like a network problem to me java.net.ConnectException: Failed to connect to /172.20.169.71:6443

Does kubectl work in the same environment?

@Memo2782
Copy link
Author

Memo2782 commented Jan 9, 2025

Hi @brendandburns looks like the client is being fetched in previous releases with ApiClient client = Config.defaultClient(); this is for version io.kubernetes', 'client-java').version('18.0.0'). For this is working fine. However for version 21.0.1 this sentence is not longer valid and is asking to fetch manually all references such as URL, Bearer-Token, and sslCACert such as this snippet represents LOGGER.info("Initializing Kubernetes API client");
//ApiClient client = initializeApiClient("https://172.20.169.71:6443");
ApiClient client = new ApiClient();
String kubeConfigPath = System.getProperty("user.home") + "/.kube/config";
String kubeConfigContent = new String(Files.readAllBytes(Paths.get(kubeConfigPath)));
client.setBasePath("https://172.20.169.71:6443");
client.addDefaultHeader("Authorization", "Bearer " + extractToken(kubeConfigContent));
i was trying to retrieve as much as information regarding the information above, but i guess this is not accurate at all. due Bearer-Token and sslCACert is being moved dinamically depending on the kubectl environment it is hosted. For that reason Config.defaultClient(), was the best approach to setup on our environments, problem as well is due the sentence execute at this stage
When i execute V1SecretList listSecret = new CoreV1Api(client).listNamespacedSecret(tlsInfo.getSecretsNamespace()
).execute();
The execute sentence goes through the execution through HTTP and i guess due the information regarding Bearer-Token and sslCACert is not well provided, for that reason is timing out.
Any workaoround to sort out Config.defaultClient();?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants