tencent cloud


Service Registration and Discovery

Last updated: 2022-09-01 11:17:26


    This document describes how to register and discover a Spring Cloud application service in the TEM console.


    Operations in console

    1. Log in to the TEM console.
    2. On the left sidebar, click Application management to enter the application management page and select a deployment region for your application.
    3. Click Create to go to the application creation page and enter the application information for deployment. For more information, see Creating and Deploying Application.
    4. For a Spring Cloud application, if a registry is associated with the selected release environment, you can select Auto Inject Registry Info.

    Specific configuration

    If you selected Auto Inject Registry Info, when you submit the service for deployment, TEM will automatically save the default parameters of the registry as a .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.

    At the same time, TEM will add the directory to the SPRING_CONFIG_ADDITIONAL-LOCATION environment variable of the application. If the variable does not exist in the application, it will be created.

    The basic configuration is as follows:

    apiVersion: v1
    kind: Deployment
    name: my-service
    - name: my-service
    image: my-image
    value: file:/config/tse-default-spring-cloud-config.properties
    - name: tse-config
    mountPath: /config/tse-default-spring-cloud-config.properties
    subPath: tse-default-spring-cloud-config.properties
    - name: tse-config
    name: tse-config
    - key: tse-default-spring-cloud-config.properties
    path: tse-default-spring-cloud-config.properties

    TEM will inject different parameters for different registries:

    Suppose the requested ZooKeeper address is

    apiVersion: v1
    tse-default-spring-cloud-config.properties: |
    kind: ConfigMap
    name: tse-config

    Notes and Precautions

    Notes on preferIpAddress

    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.

    If a 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.

    Notes on Spring Boot additional location

    The SPRING_CONFIG_ADDITIONAL-LOCATION environment variable automatically added by TEM enables you to externally customize the configuration of a Spring Boot application, but it takes effect only in Spring Boot v2.0 or later.

    If you use Spring Boot 1.x, add the mounted directory /config/tse-default-spring-cloud-config.properties to the SPRING_CONFIG_LOCATION environment variable on your own.

    You can also set this by directly adding the JVM launch parameters as follows:

    # Suppose the requested ZooKeeper address is ``

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support