This topic tells you how create, bind, and unbind services on Tanzu Platform for Kubernetes.
Services are integral to the application development life cycle. This topic describes how to provision new services and bind them to your application so it can consume those services.
You can use the Tanzu services CLI plug-in or Tanzu Platform hub to create and bind based on your requirements. You can also choose the types of services to use within your Space:
These provide a quick and easy way to add backing services in Spaces using dynamic provisioning. However, the Bitnami services are limited to single Availability Targets and replica sets. Bitnami services are more suitable for development environments, to allow easy self-service and quick iteration.
These require additional configuration. You can use them to make services from the provider of your choice available across multiple Availability Targets. Pre-provisioned services are more suitable for staging and production environments, to provide higher availability and resiliency.
After you create your services, you can bind and unbind them to your application or delete them.
For more information about binding services, see What are services and service bindings.
The Bitnami-based backing services use services from the Bitnami Catalog, which are deployed to the Space. Backing services from Bitnami are deployed in each Availability Target and replica.
If you have multiple Availability Targets or replicas, you will have multiple instances of the Bitnami services deployed. Because these currently do not replicate to each other, deployed applications are functional, but data is split-brained between replicas and Availability Targets.
ImportantIf using an Amazon EKS cluster that’s running Kubernetes v1.30 or later, you must mark a storage class as default using the
storageclass.kubernetes.io/is-default-class
annotation. In v1.30 and later, EKS does not include the default annotation on thegp2
StorageClass resource applied to newly created clusters. For more information, see the Amazon EKS documentation. If you do not do this, persistent volume claims will not acquire a volume. For more information about the default storage class, see the Kubernetes documentation.
Log in to Tanzu Platform hub.
Navigate to Application Spaces > Spaces.
Select the Space in which you want to create the service.
Navigate to the Services tab.
Click Create Service at the top right of the Services summary view.
In the dialog box, click Create Service.
Select the service you want from the table that lists the services available for dynamic provisioning.
Click Next.
Enter a Service Name.
Enter service parameters, for example, for a RabbitmqCluster service you can set the Storage GB and Replicas parameters.
(Optional) Bind the service to a ContainerApp or Deployment. If you don’t want to bind the application now you can do so later.
Click Create Service to finish creating your dynamically provisioned service.
View the services in the Space by running:
tanzu services list
There are likely no services.
List the available service types by running:
tanzu services type list
Example output:
NAME
RabbitmqCluster
KafkaInstance
RedisCluster
ValkeyCluster
MongoDBInstance
PostgreSQLInstance
MySQLInstance
CassandraCluster
Neo4jInstance
Create a Bitnami service by running:
tanzu services create SERVICE-TYPE/SERVICE-NAME
Where:
SERVICE-TYPE
is the type of service you want to create.SERVICE-NAME
is the name you want for your service.For example:
$ tanzu services create MySQLInstance/where-for-dinner-mysql
$ tanzu services create RabbitmqCluster/where-for-dinner-rabbitmq
Verify that the services are now available in the Space by running:
tanzu services list
You will see the service you just provisioned running in your space.
To find out more information about your service, run:
tanzu services get SERVICE-TYPE/SERVICE-NAME
Where:
SERVICE-TYPE
is the type of service.SERVICE-NAME
is the name of the service.For example:
$ tanzu services get MySQLInstance/where-for-dinner-mysql
$ tanzu services get RabbitmqCluster/where-for-dinner-rabbitmq
To edit the parameters of a dynamically provisioned Bitnami backing service using Tanzu Platform hub:
Log in to Tanzu Platform hub.
Navigate to Application Spaces > Spaces.
Select the Space in which you want to create the service.
Navigate to the Services tab.
Click a dynamically provisioned Bitnami backing service to go to its Service Details page.
In the Service Parameters section click Edit. A new page with the editable parameters of the service appears.
Edit the values for the parameters as required.
Save your changes by clicking Edit, or click Cancel to cancel.
You can also attach existing services. This is usually used to consume production-level services such as cloud-based services.
Log in to Tanzu Platform hub.
Navigate to Application Spaces > Spaces.
Select the Space in which you want to create the service.
Navigate to the Services tab.
Click Create Service at the top right of the Services summary view.
In the dialog box, click Attach Service.
Enter the service details including Service Name, Description, and Contact Information.
Enter the binding connector details. Binding connectors are the available slots on the service side to which an application can connect. You can a configure Binding connector per Availability Target or choose to use one configuration for all Availability Targets into which the space is scheduled. For the list of binding connector types and their available configuration details, see Spring Cloud Bindings.
Enter a Connector Name. This can be any string. The name distinguishes the connector from others.
Enter the Binding Type. This can be any of the supported service types as defined in Spring Boot Configuration. For example, postgresql
.
Choose if you want the same configuration for the connector for all Availability Targets.
If you want the same configuration for all Availability Targets: Click Add Binding Detail to enter the connection details for the connector.
If you want different configuration for each Availability Target: Select the Availability Targets that you want to configure, and then, for each Availability Target, click Add Binding Detail to enter the connection details for the connector.
Connection details must have keys that correspond to the connector type in PostgreSQL relational database management system (RDBMS). For example, for type postgresql
, if you populate the host, port, and database keys, the spring.r2dbc.url
configuration in your application is set to 2dbc:postgresql://{host}:{port}/{database}
.
When adding a key in the Binding Details section, a drop-down menu might appear that suggests connection details keys based on the binding type.
Click Add Binding Connector to configure another connector, or click Next to proceed to the next step.
(Optional) Enter the application binding details. This section allows you to bind to an a application after the service is attached.
Select the application you want to bind to the service.
Select the application binding alias. This is the binding slot on the application side that will be connected to the binding connector on the service side.
Select the defined binding connectors you want to bind this application to.
Click Add Service Binding to configure another application.
Click Create Service to finish creating the pre-provisioned service. You will be taken back to the Services Details page for your pre-provisioned service.
In a Space, create a pre-provisioned service using the Tanzu Services CLI plug-in by running:
tanzu services create PreProvisionedService/SERVICE-NAME
Where SERVICE-NAME
is the name you want for your service.
For example:
$ tanzu services create PreProvisionedService/prod-mysql
This command configures a PreProvisionedService
resource with a binding connector of the selected type. For the available types, see Spring Cloud Bindings.
List the services that are available in the Space and to verify the PreProvisionedService
was created by running:
tanzu services list
After you create a pre-provisioned service, you can edit the details for the binding connectors as follows:
Log in to Tanzu Platform hub.
Navigate to Application Spaces > Spaces.
Select the Space in which the service is located.
Navigate to the Services tab.
Click a pre-provisioned service to go to its Service Details page.
In the Binding Connectors section, where the UI lists the binding connectors for the service, click Edit.
A new page opens where you can edit the details of existing binding connectors, such as the Description, Binding Details, and Egress Configutation. You cannot edit Connector Name and Binding Type.
To add a new binding connector click Add Binding Connector and fill in the form as described in Attach a backing service using pre-provisioned services earlier.
To remove an binding connector, click the trash icon at the upper right of the binding connector form.
NoteRemoving a binding connector is not possible when there is only one binding connector because a pre-provisioned service must have at least one connector.
You will be navigated back to the Service Details page.
After you create a service in your Space, you can bind or unbind your services using either Tanzu Platform hub or the Tanzu CLI.
On the Service Details page, Click Bind at the top right of the screen.
Select the ContainerApp or Deployment you want to bind to within your Space.
Select the application binding alias. This alias is the binding slot on the application side that connects to the binding connector on the service side.
Select the defined binding connectors that you want to bind the application to.
Click Add Service Binding to add a binding to another application or click Bind Service to Application to finish binding your application.
To unbind a service using Tanzu Platform hub:
Navigate to the Services Details page.
In the Bound Applications widget under the actions column, click Unbind.
Click the pop up box which confirms you want to remove the binding to the application.
tanzu service bind SERVICE-TYPE/SERVICE-NAME ContainerApp/CONTAINERAPP-NAME --as BINDING-NAME
Where:
SERVICE-TYPE
is the type of service you want to bind to.SERVICE-NAME
is the name of the service you want to bind to.CONTAINERAPP-NAME
is the name of the ContainerApp you want to bind to the service.BINDING-NAME
is the name of the service binding.For example:
$ tanzu service bind MySQLInstance/my-sql-service-1 ContainerApp/container-app-1 --as mysql-db
To unbind a service using the Tanzu CLI, run:
tanzu service unbind SERVICE-TYPE/SERVICE-NAME ContainerApp/CONTAINERAPP-NAME --alias BINDING-NAME
Where:
SERVICE-TYPE
is the type of service you want to unbind from the app.SERVICE-NAME
is the name of the service you want to unbind from the app.CONTAINERAPP-NAME
is the name of the ContainerApp you want to unbind from the service.BINDING-NAME
is the name of the service binding to be removed.For example:
$ tanzu service unbind MySQLInstance/my-sql-service-1 ContainerApp/container-app-1 --alias mysql-db
NoteMost
tanzu service
sub-commands support an interactive flow when they are executed without any parameters. For example, if you run$ tanzu service bind
, you trigger the interactive flow where the Tanzu CLI prompts you to populate the service and the ContainerApp.
You can also delete a service using either Tanzu Platform hub or the Tanzu CLI.
Navigate to the Services Details page.
Click Delete Service at the top right of the Service Details page.
In the pop up box, confirm the name of the service to delete the service from your Space.
tanzu service delete SERVICE-TYPE/SERVICE-NAME ContainerApp/CONTAINERAPP-NAME
Where:
SERVICE-TYPE
is the type of service you want to delete.SERVICE-NAME
is the name of the service you want to delete.CONTAINERAPP-NAME
is the name of your ContainerApp.For example:
$ tanzu service delete MySQLInstance/my-sql-service-1 ContainerApp/container-app-1