Kubernetes client (certificate) exception is thrown when spring-cloud-starter-kubernetes-config added as a dependency

8/5/2021

I encountered the following error when added spring-cloud-starter-kubernetes-config dependency to my 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:

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?

-- Elena
java
kubernetes
maven

1 Answer

8/5/2021

That problem could happen due to the installed kubectl. The easiest way to avoid this problem - rename ~/.kube (directory with configs) to some other name like ~/.kube-hide

mv ~/.kube ~/.kube-hide

And when you will need to use your kubectl rename it back

-- Marshtupa
Source: StackOverflow