.properties file to the ConfigMap named tse-config in the environment and mount it to the /config/tse-default-spring-cloud-config.properties directory of the application in the form of VolumeMounts.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
10.0.1.30:2181: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
10.0.120.11:8848:apiVersion: v1data:tse-default-spring-cloud-config.properties: |spring.cloud.nacos.discovery.server-addr=10.0.120.11:8848kind: ConfigMapmetadata:name: tse-config
xxx.preferIpAddress=true is added to all injected registry parameters, as when Spring Cloud gets the local server IP (i.e., Pod IP in TEM), it will automatically query the domain name based on the IP; if preferIpAddress is determined to be false (default value), the service will be registered through the domain name; otherwise, it will be registered through the IP.PodName is mapped by the Pod IP in TEM, that is, if preferIpAddress=true is not set, then the address registered with the registry will be a PodName, which will be the service instance address pulled by other services from the registry, making the instance inaccessible through the PodName./config/tse-default-spring-cloud-config.properties to the SPRING_CONFIG_LOCATION environment variable on your own.# Suppose the requested ZooKeeper address is `10.0.1.30:2181`-Dspring.cloud.zookeeper.connectString=10.0.1.30:2181-Dspring.cloud.zookeeper.discovery.preferIpAddress=true
# Suppose the requested Nacos address is `10.0.120.11:8848`-Dspring.cloud.nacos.discovery.server-addr=10.0.120.11:8848
Feedback