This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Cloud Kubernetes 5.0.1!spring-doc.cn

Kubernetes PropertySource implementations

The most common approach to configuring your Spring Boot application is to create an application.properties or application.yaml or an application-profile.properties or application-profile.yaml file that contains key-value pairs that provide customization values to your application or Spring Boot starters. You can override these properties by specifying system properties or environment variables.spring-doc.cn

To enable this functionality you need to set the spring.config.import application configuration property to kubernetes: (escape with quotes when using yaml eg. "kubernetes:"):spring-doc.cn

spring:
  config:
    import: "kubernetes:"

If you would like to load Kubernetes PropertySources during the bootstrap phase like it worked prior to the 3.0.x release you can either add spring-cloud-starter-bootstrap to your application’s classpath or set spring.cloud.bootstrap.enabled=true as an environment variable.spring-doc.cn

It is not supported to load properties during Bootstrap (using spring-cloud-starter-bootstrap or spring.cloud.bootstrap.enabled=true and load properties using spring.config.import. You must use one or the other method.