spring boot 在 k8s 使用 kubernets configmap作为配置中心
引用& 参考
https://amit4aws.medium.com/spring-cloud-kubernetes-configwatcher-7a206fe269e3
https://github.com/spring-cloud/spring-cloud-kubernetes#kubernetes-propertysource-implementations
spring boot 服务程序读取 kubernets configmap 配置
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-kubernetes-config</artifactId>
<version>1.1.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Spring boot 版本使用:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.11.RELEASE</version>
创建项目配置文件 bootstrap.yml
spring:
application:
name: projectName
cloud:
kubernetes:
reload: