question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
wind57commented, Jun 22, 2021

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

0reactions
wind57commented, Jul 15, 2021

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception on spring application startup with spring-cloud ...
Exception on spring application startup with spring-cloud-kubernetes config maps dependencies present ... I have a few spring services which has ...
Read more >
Best practices on Spring Cloud Kubernetes bootstrap ...
In this article I want to show the best way to configure any Spring Cloud bootstrap properties in your application, making it the...
Read more >
Apereo CAS - Spring Cloud & Kubernetes - Fawnoos
Our deployment should be given enough permissions to read the ConfigMap at bootstrap time. First, we can easily switch the Docker images ...
Read more >
7. Spring Cloud Config Client
The net result of doing so is that client applications all need a bootstrap.yml (or an environment variable) with the appropriate discovery configuration....
Read more >
Spring Cloud - Bootstrapping - Baeldung
2. Config Server · 2.1. Setup · 2.2. Spring Config · 2.3. Properties · 2.4. Git Repository · 2.5. Run · 2.6. Bootstrapping...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found