For the latest stable version, please use Spring Cloud Kubernetes 3.2.0!

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.

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:"). Currently you can not specify a ConfigMap or Secret to load using spring.config.import, by default Spring Cloud Kubernetes will load a ConfigMap and/or Secret based on the spring.application.name property. If spring.application.name is not set it will load a ConfigMap and/or Secret with the name application.

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.

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.