spring.cloud.kubernetes.enabled=false is not read from bootstrap.yml in bootstrap run of `AbstractKubernetesProfileEnvironmentPostProcessor`
See original GitHub issueContext:
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
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:18 (12 by maintainers)
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
@limkinZero I think I know where your issue comes from. You need to set that property in
bootstrap.yaml
as the reading of config maps happens at the bootstrap level, see here.