[英]Kubernetes client (certificate) exception is thrown when spring-cloud-starter-kubernetes-config added as a dependency
I encountered the following error when added spring-cloud-starter-kubernetes-config dependency to my pom.xml:将spring-cloud-starter-kubernetes-config依赖添加到我的 pom.xml 时遇到以下错误:
io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred. Caused by: java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Empty input Caused by: java.io.IOException: Empty input
To disable k8s, I added in bootstrap.yml following param:为了禁用 k8s,我在 bootstrap.yml 中添加了以下参数:
spring:
cloud:
kubernetes:
enabled: false
But even after that nothing changed and the error remained.但即使在那之后没有任何改变,错误仍然存在。
Where else should I look?我还应该去哪里看? What parameter should I add so that if I have this dependency in pom.xml, I disable Kubernetes when running tests?
我应该添加什么参数,以便如果我在 pom.xml 中有这个依赖项,我在运行测试时禁用 Kubernetes?
That problem could happen due to the installed kubectl
.由于安装了
kubectl
,可能会发生该问题。 The easiest way to avoid this problem - rename ~/.kube
(directory with configs) to some other name like ~/.kube-hide
避免此问题的最简单方法 - 将
~/.kube
(带有配置的目录)重命名为其他名称,例如~/.kube-hide
mv ~/.kube ~/.kube-hide
And when you will need to use your kubectl
rename it back当您需要使用您的
kubectl
时,将其重命名
As stated on the Spring Cloud Kubernetes documentation如 Spring Cloud Kubernetes 文档中所述
Also note that these properties: spring.cloud.kubernetes.config.enabled and spring.cloud.kubernetes.secrets.enabled only take effect when set in bootstrap.{properties|yml}
还要注意这些属性:spring.cloud.kubernetes.config.enabled 和 spring.cloud.kubernetes.secrets.enabled 只有在 bootstrap 中设置时才会生效。{properties|yml}
https://docs.spring.io/spring-cloud-kubernetes/docs/current/reference/html/#kubernetes-ecosystem-awareness https://docs.spring.io/spring-cloud-kubernetes/docs/current/reference/html/#kubernetes-ecosystem-awareness
So, to actually disable this property, it has to be set in bootstrap.{properties|yml}
and not in application.{properties|yml}
.所以,要真正禁用这个属性,它必须在
bootstrap.{properties|yml}
而不是application.{properties|yml}
中设置。
Also, you can pass the value as a VM option:此外,您可以将该值作为 VM 选项传递:
-Dspring.cloud.kubernetes.enabled=false
if you want to run the application locally.如果您想在本地运行应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.