创建kubernetes服务和部署时PKIX路径验证失败

时间:2020-04-19 18:56:09

标签: java kubernetes pki

我真的被困在这里,所以希望有人可以向正确的方向推动我。 如前几篇文章所述,我已经继承了别人的部分项目,所以请原谅我的无知。 我有一个在CentOS服务器上运行的Kubernetes集群。我有一个小的Java项目正在尝试创建服务和部署,但是我不断获得

SEVERE: Failed to create k8s deployment and service 
io.kubernetes.client.ApiException: javax.net.ssl.SSLHandshakeException: PKIX path validation failed:
java.security.cert.CertPathValidatorException: signature check failed
at io.kubernetes.client.ApiClient.execute(ApiClient.java:805)
at io.kubernetes.client.apis.CoreV1Api.createNamespacedServiceWithHttpInfo(CoreV1Api.java:9415)
at io.kubernetes.client.apis.CoreV1Api.createNamespacedService(CoreV1Api.java:9397)
at com.mystuff.pivcontroller.Piv.deployToK8s(Piv.java:195)
...
Caused by: java.security.SignatureException: Signature does not match.
at java.base/sun.security.x509.X509CertImpl.verify(X509CertImpl.java:456)
at java.base/sun.security.provider.certpath.BasicChecker.verifySignature(BasicChecker.java:166)
at java.base/sun.security.provider.certpath.BasicChecker.check(BasicChecker.java:147)
at java.base/sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:125)
... 65 more

这是发生问题的代码部分,尽管我假设它与代码无关,可能与某些证书不匹配或有关。

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

Yaml.addModelMap("apps/v1", "Deployment", V1Deployment.class);
Yaml.addModelMap("v1", "Service", V1Service.class);

this.log.logDebug("Loading YAML files from disk");
V1Deployment yamlDeployment = (V1Deployment)Yaml.load(pivDeploymentYaml);
V1Service yamlService = (V1Service)Yaml.load(pivServiceYaml);

this.log.logDebug("Creating K8s service");
CoreV1Api coreApi = new CoreV1Api(client);
V1Service resultService = coreApi.createNamespacedService(PivConfig.K8sNamespace, yamlService, null, null, null); // <<<< line 195
this.log.logInfo("Built Service " + resultService.getMetadata().getName());

this.log.logDebug("Creating K8s deployment");
AppsV1Api appsApi = new AppsV1Api(client);
V1Deployment resultDeployment = appsApi.createNamespacedDeployment(PivConfig.K8sNamespace, yamlDeployment, null, null, null);
this.log.logInfo("Built Deployment: " + resultDeployment.getMetadata().getName());

有人知道这里发生了什么吗?我非常感谢有关如何调试此问题的任何建议。

谢谢

0 个答案:

没有答案