This topic tells you how to increase resilience for your Kubernetes applications in Tanzu Platform.
Typically, applications deployed into production environments have resiliency requirements. This could be a simple requirement of having multiple instances of the application running to protect against localized failures, or a complex requirement of having a geographically distributed application to provide clear fault domain boundaries between regions.
You can define the resiliency requirements for your Space so that when you deploy an application to the Space, you receive these resilience characteristics for your application.
This topic describes how to increase the resiliency of an application in two ways:
-
Increase the number of application instances within a region: This will increase the number of instances of your application running by adding a new cluster within your availability target. This protects your application from issues with a given cluster, but not within a given region.
-
Increase the number of application instances across regions: This will increase the number of instances of your application running by adding a new cluster to a new Availability Target in an additional region.
Before you begin
When deploying your application, you deployed your application with backing services from Bitnami.
Bitnami services are not synchronized between Space replicas. The result of increasing application resiliency by using Bitnami services is isolated backing services, which can result in a split brain application.
Increase Application Availability within a Single Region
Increasing application resiliency within a region is accomplished by increasing the number of replicas within an availability target. In the Availability Target context, a replica is an individual Kubernetes cluster.
The steps provided in the Getting Started guide deploys an application to a Space that uses the Tanzu provided all-regions.tanzu.vmware.com
availability target which includes all clusters regardless of region. To increase the resiliency of an application within a single region, do the following:
-
Create an Availability Target for the region that your cluster is in by following the instructions in How to use Availability Targets.
-
Attach two clusters that are in the same VPC and region that you defined in your Availability Target and use the default Run cluster group. For instructions, see Attach a Kubernetes cluster as a VMware Tanzu Platform data source.
This will add the two clusters to the region based Availability Target you created.
-
Update the Availability Target to use the region based availability target and number of replicas from 1 to 2 to schedule the Space to the newly created cluster.
- UI-based steps
- Do the following in the Tanzu Platform UI:
- On the left navigation pane, go to Spaces > Overview.
- Click the vertical ellipsis next to your Space and select Edit Space
- In the Availability Targets drop down, change the availability target from
all-regions.tanzu.vmware.com
to the new region based availability target created above. - On Availability Targets, change the number of Replicas from
1
to2
- Click Update Space to apply the changes.
- Tanzu CLI-based steps
- Do the following from Tanzu CLI:
-
Set your Tanzu CLI context. Run the following command to authenticate to Tanzu Platform.
tanzu login
-
Set the scope to your project.
-
Run the following command to view the available list of projects.
tanzu project list
-
Run the following command to set the project context.
tanzu project use PROJECT-NAME
-
-
Update the
space.yaml
manifest you used in Create a Space to change the replica count from 1 to 2 for your Availability Target. For example:apiVersion: spaces.tanzu.vmware.com/v1alpha1 kind: Space metadata: name: my-first-space namespace: default spec: template: spec: profiles: - name: spring.tanzu.vmware.com availabilityTargets: - name: at-us-east-1 replicas: 2 updateStrategy: type: RollingUpdate
-
Apply the manifest to create the Space in your project.
tanzu deploy --only space.yaml
-
When you added a new cluster in the cluster group, the configuration of the cluster group was applied to the new cluster, resulting in the two clusters having the same configuration. The Availability Target then detects the new cluster in the region, and makes it available as an additional replica target for your space.
By changing the replica count from one to two on the Space, your deployed Where for Dinner?
application will be deployed to the newly created cluster, giving your application resilience to failures within a single cluster.
Be sure to check out the topology of your Space to see the second instance of your application running.
Increase application availability in a second region
Increasing your application’s resiliency to be resistant to faults across regions is accomplished by adding an second Availability Target to your Space. This will ensure that your application is replicated across regions so that a failure of a region will not impact your applications availability.
To increase your application resiliency across a second region, do the following:
- Attach a cluster in the newly created VPC using the default Run cluster group. For instructions, see Attach a Kubernetes cluster as a VMware Tanzu Platform data source.
- Create a new Availability Target specifying the new region by following the instructions in How to use Availability Targets.
-
Add the new Availability Target to the Space
- UI-based steps
- Do the following in the Tanzu Platform UI:
- On the left navigation pane, go to Spaces > Overview.
- Click the vertical ellipsis next to your Space and select Edit Space
- Under Availability Targets, click + Add availability target and select your new availability target from the drop down. Since we only have 1 cluster in the new availability target, enter
1
replica. - Click Update Space to apply the changes.
- Tanzu CLI-based steps
- Do the following from Tanzu CLI:
-
Set your Tanzu CLI context. Run the following command to authenticate to Tanzu Platform.
tanzu login
-
Set the scope to your project.
-
Run the following command to view the available list of projects.
tanzu project list
-
Run the following command to set the project context.
tanzu project use PROJECT-NAME
-
-
Update the
space.yaml
manifest you used in Create a Space to add the new Availability Target to the Space with a replica count of 1. For example:apiVersion: spaces.tanzu.vmware.com/v1alpha1 kind: Space metadata: name: my-first-space namespace: default spec: template: spec: profiles: - name: spring.tanzu.vmware.com availabilityTargets: - name: at-us-east-1 replicas: 2 - name: at-us-west-1 replicas: 1 updateStrategy: type: RollingUpdate
-
Apply the manifest to create the Space in your project.
tanzu deploy --only space.yaml
-
By adding an Availability Target to your Space, the deployed Where for Dinner?
application will automatically be deployed to the new Availability Target, giving your application resilience to failures within a region.
Be sure to check out the topology of your Space to see the second region of your application running.
Content feedback and comments