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.
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.
Do the following to deploy Config Server to your Space and bind the service to an application.
List the available service instance types by running:
tanzu services type list
NAME
ConfigServer
EurekaServer
...
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.
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
Bind ConfigServer
to a ContainerApp
:
tanzu services bind ConfigServer/my-config ContainerApp/test-deployment --as config
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.
NoteService 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.
List the available service instance types by running:
tanzu services type list
NAME
ConfigServer
EurekaServer
...
Create an EurekaServer instance in the Space:
tanzu service create EurekaServer/eurekaserver --parameter backends='[{tls: {activated: true}}]'
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
Bind ServiceRegistry
to a ContainerApp
:
tanzu services bind EurekaServer/eurekaserver ContainerApp/test-deployment --as eureka
NoteThough a service mesh is available, TLS is still needed so that clients using Spring Cloud Bindings can correctly contact Service Registry using IP.
eureka.preferipaddress=true
to applications.