如下报错一般是你没有将k8s的config拷贝到项目里,你可以将k8s主节点的config拷贝一下到项目中。
2025-02-13 09:27:21.873 ERROR 1671 --- [.models.V1Pod-1] i.k.c.informer.cache.ReflectorRunnable : class io.kubernetes.client.openapi.models.V1Pod#Reflector loop failed unexpectedlyio.kubernetes.client.openapi.ApiException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetat io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:888)at io.kubernetes.client.informer.SharedInformerFactory$1.list(SharedInformerFactory.java:222)at io.kubernetes.client.informer.cache.ReflectorRunnable.run(ReflectorRunnable.java:91)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308)at java.util.concurrent.FutureTask.runAndReset(FutureTask.java)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:750)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetat sun.security.ssl.Alert.createSSLException(Alert.java:131)at sun.security.ssl.TransportContext.fatal(TransportContext.java:377)at sun.security.ssl.TransportContext.fatal(TransportContext.java:320)at sun.security.ssl.TransportContext.fatal(TransportContext.java:315)at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1349)at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1224)at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1167)at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:376)at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:479)at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:457)at sun.security.ssl.TransportContext.dispatch(TransportContext.java:200)at sun.security.ssl.SSLTransport.decode(SSLTransport.java:155)at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1320)at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1233)at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:417)at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:389)at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379)at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337)at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209)at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:884)... 10 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetat sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)at sun.security.validator.Validator.validate(Validator.java:271)at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:312)at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:221)at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:128)at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1333)... 39 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetat sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:148)at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:129)at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)... 45 common frames omitted```