Configure Spring Cloud Services

Configure Spring Cloud Services to provide Spring Cloud configuration and Service Discovery to Spring applications that Tanzu Platform for Kubernetes manages.

The following provide you the steps for deploying Spring Cloud Services Config Server and Service Registry to a Space and binding the services to an application.

Before you begin

Make sure that the cert-manager Capability is installed before you deploy Tanzu Config Server or Service Registry (Eureka). For the steps on how to make the Capabilities available in your Space, see Install Capabilities on your Kubernetes cluster.

For information about binding services to applications, see also What are Services and Service Bindings and Bind backing services to your application.

For more information about Spring Cloud Services, see Config Server and Service Registry with Spring Cloud Services.

Deploy Config Server to a Space

Do the following to deploy Config Server to your Space and bind the service to an application.

  1. List the available service instance types by running:

    tanzu services type list
    
    NAME
    ConfigServer
    EurekaServer
    ...
    
  2. Create a ConfigServer instance in the Space:

    tanzu service create ConfigServer/my-config  --parameter backends='[{git: {uri: https://github.com/spring-cloud-services-samples/cook-config}}]'
    

    For detailed configuration options, see the Tanzu Config Server documentation.

  3. Verify that Config Server is available.

    When ConfigServer is available, it will be visible in the Tanzu services list and be available for service binding.

    tanzu services list
    
  4. Bind ConfigServer to a ContainerApp:

    tanzu services bind ConfigServer/my-config ContainerApp/test-deployment --as config
    

Deploy Service Registry to a Space

Service Registry is an implementation of Spring Cloud Eureka, and is described as EurekaServer after it is installed. It provides a service discovery pattern for applications to use.

Note

Service Registry is scoped to a single Space replica.

Do the following to deploy Service Registry to your Space and bind the service to an application.

  1. List the available service instance types by running:

    tanzu services type list
    
    NAME
    ConfigServer
    EurekaServer
    ...
    
  2. Create an EurekaServer instance in the Space:

    tanzu service create EurekaServer/eurekaserver --parameter backends='[{tls: {activated: true}}]'
    
  3. Verify that EurekaServer is available. When EurekaServer is available, it will be visible in the Tanzu services list and be available for service binding.

    tanzu services list
    
  4. Bind ServiceRegistry to a ContainerApp:

    tanzu services bind EurekaServer/eurekaserver ContainerApp/test-deployment --as eureka
    
    Note

    Though a service mesh is available, TLS is still needed so that clients using Spring Cloud Bindings can correctly contact Service Registry using IP.

  5. (Optional) You can work around the limitation by adding the environment variable eureka.preferipaddress=true to applications.
check-circle-line exclamation-circle-line close-line
Scroll to top icon