公告
产品动态
tse-config 的 ConfigMap 中,并通过 VolumeMounts 的形式,挂载到应用的 /config/tse-default-spring-cloud-config.properties 目录下。apiVersion: v1kind: Deploymentmetadata:name: my-servicespec:containers:- name: my-serviceimage: my-imageenv:- name: SPRING_CONFIG_ADDITIONAL-LOCATIONvalue: file:/config/tse-default-spring-cloud-config.propertiesvolumeMounts:- name: tse-configmountPath: /config/tse-default-spring-cloud-config.propertiessubPath: tse-default-spring-cloud-config.propertiesvolumes:- name: tse-configconfigMap:name: tse-configitems:- key: tse-default-spring-cloud-config.propertiespath: tse-default-spring-cloud-config.properties
apiVersion: v1data:tse-default-spring-cloud-config.properties: |spring.cloud.zookeeper.connectString=10.0.1.30:2181spring.cloud.zookeeper.discovery.preferIpAddress=truekind: ConfigMapmetadata:name: tse-config
apiVersion: v1data:tse-default-spring-cloud-config.properties: |spring.cloud.nacos.discovery.server-addr=10.0.120.11:8848kind: ConfigMapmetadata:name: tse-config
/config/tse-default-spring-cloud-config.properties 自行添加到 SPRING_CONFIG_LOCATION 环境变量中。# 假设申请的 zookeeper 地址为:10.0.1.30:2181-Dspring.cloud.zookeeper.connectString=10.0.1.30:2181-Dspring.cloud.zookeeper.discovery.preferIpAddress=true
# 假设申请的nacos地址为:10.0.120.11:8848-Dspring.cloud.nacos.discovery.server-addr=10.0.120.11:8848
文档反馈