spring-cloud-kubernetes: spring.cloud.kubernetes.enabled=false is not read from bootstrap.yml in bootstrap run of `AbstractKubernetesProfileEnvironmentPostProcessor`

Context: Spring Boot 2.5.1 Spring Cloud 2020.0.3 Using spring-cloud-starter-kubernetes-fabric8

When starting an application with spring.cloud.kubernetes.enabled=false defined on bootstrap.properties, this flag is not added to the environment and it causes the application to create a DefaultKubernetesClient instance which will try to interact with a K8s cluster. This can be seen debugging the supplied example application with a breakpoint on AbstractKubernetesProfileEnvironmentPostProcessor line 61.

In my case, I have a k8s config file with a defined cluster that uses OIDC authentication. When I run the supplied application, even though I disabled spring.cloud.kubernetes, the application opens a browser to start the authentication process and hangs the startup.

Application: https://github.com/pandrez/spring-cloud-kubernetes

If you need more information, please let me know

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I had more time to look at the problem you reported today and yes, I agree this is a bug. At least imo. The solution in your case is trivial, just start the application with an environment property, for example -DSPRING_CLOUD_KUBERNETES_ENABLED=false.

I’ll see if I can come up with a fix