This how-to guide walks the application developer through deploying two application workloads and configuring them to communicate over RabbitMQ. You will learn about the tanzu services
CLI plug-in and the most important APIs for working with services on Tanzu Application Platform.
Important: This walkthrough assumes that the service operator and application operator has already:
- Set up a service.
- Created a service instance.
- Claimed the service instance.
This is described in Set up services for consumption by developers.
Before you begin, for important background, see About consuming services on Tanzu Application Platform.
The following diagram depicts a summary of what this walkthrough covers, including the work of the service and application operators described in Set up services for consumption by developers.
Bear the following observations in mind as you work through this guide:
There is a clear separation of concerns across the various user roles.
ProvisionedService is the contract allowing credentials and connectivity information to flow from the service instance, to the resource claim, to the service binding, and ultimately to the application workload. For more information, see ProvisionedService on GitHub.
Before following this walkthrough, you must:
default
namespace to use installed packages and use it as your developer namespace. For more information, see Set up developer namespaces to use installed packages.As application developer, you are now ready to inspect the resource claim created for the service instance by the application operator in Set up services for consumption by developers and use it to bind to application workloads.
This section covers:
tanzu service claim list
and tanzu service claim get
to find information about the claim to use for binding.tanzu apps workload create
with the --service-ref
flag to create a workload and bind it to the service instance.You must create application workloads and bind them to the service instance using the claim.
In Tanzu Application Platform, service bindings are created when you create application workloads that specify .spec.serviceClaims
. In this section, you create such workloads by using the --service-ref
flag of the tanzu apps workload create
command.
To create an application workload:
Inspect the claims in the developer namespace to find the value to pass to --service-ref
command by running:
tanzu service claim list
Expected output:
NAME READY REASON
rmq-1 True
Retrieve detailed information about the claim by running:
tanzu service claim get rmq-1
Expected output:
Name: rmq-1
Status:
Ready: True
Namespace: default
Claim Reference: services.apps.tanzu.vmware.com/v1alpha1:ResourceClaim:rmq-1
Resource to Claim:
Name: rmq-1
Namespace: service-instances
Group: rabbitmq.com
Version: v1beta1
Kind: RabbitmqCluster
Record the value of Claim Reference
from the previous command. This is the value to pass to --service-ref
to create the application workload.
Create the application workload by running:
tanzu apps workload create spring-sensors-consumer-web \
--git-repo https://github.com/sample-accelerators/spring-sensors-rabbit \
--git-branch main \
--type web \
--label app.kubernetes.io/part-of=spring-sensors \
--annotation autoscaling.knative.dev/minScale=1 \
--service-ref="rmq=services.apps.tanzu.vmware.com/v1alpha1:ResourceClaim:rmq-1"
tanzu apps workload create \
spring-sensors-producer \
--git-repo https://github.com/tanzu-end-to-end/spring-sensors-sensor \
--git-branch main \
--type web \
--label app.kubernetes.io/part-of=spring-sensors \
--annotation autoscaling.knative.dev/minScale=1 \
--service-ref="rmq=services.apps.tanzu.vmware.com/v1alpha1:ResourceClaim:rmq-1"
Using the --service-ref
flag instructs Tanzu Application Platform to bind the application workload to the service provided in the ref
.
Note: You are not passing a service ref to the
RabbitmqCluster
service instance directly, but rather to the resource claim that has claimed theRabbitmqCluster
service instance. See the consuming services diagram at the beginning of this walkthrough.
spring-sensors-consumer-web
app. Confirm that sensor data, passing from the spring-sensors-producer
workload to the create spring-sensors-consumer-web
workload using the RabbitmqCluster
service instance, is displayed.There are more service use cases not covered in this getting started guide. See the following:
Use Case | Short Description |
---|---|
Consuming AWS RDS on Tanzu Application Platform | Using the Controllers for Kubernetes (ACK) to provision an RDS instance and consume it from a Tanzu Application Platform workload. Involves making a third-party API consumable from Tanzu Application Platform. |
Consuming AWS RDS on Tanzu Application Platform with Crossplane | Using Crossplane to provision an RDS instance and consume it from a Tanzu Application Platform workload. Involves making a third-party API consumable from Tanzu Application Platform. |
Consuming Google Cloud SQL on Tanzu Application Platform with Config Connector | Using GCP Config Connector to provision a Cloud SQL instance and consume it from a Tanzu Application Platform workload. Involves making a third-party API consumable from Tanzu Application Platform. |
Consuming Google Cloud SQL on Tanzu Application Platform with Crossplane | Using Crossplane to provision a Cloud SQL instance and consume it from a Tanzu Application Platform workload. Involves making a third-party API consumable from Tanzu Application Platform. |
Direct Secret References | Binding to services running external to the cluster, for example, an in-house oracle database. Binding to services that do not conform with the binding specification. |
Dedicated Service Clusters (Experimental) | Separates application workloads from service instances across dedicated clusters. |
For more information about the APIs and concepts underpinning Services on Tanzu Application Platform, see the Services Toolkit Component documentation.
Now that you’ve completed the Getting started guides, learn about: