This topic tells you how to increase application resilience on Tanzu Platform for Kubernetes.
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.
When deploying your application, you deployed your application with one of two options for backing services, Bitnami or AWS. Either backing service will work for this example. However, Bitnami services are not synchronized between Space replicas.
The result of increasing application resiliency while using Bitnami services will be isolated backing services, which will result in a split brain application. Using AWS will provide a shared backing service for all application instances and will provide the most optimal scenario for this example.
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 you created the cluster in using the getting starting guide using the Manage Availability Target How To
Use the create a cluster documentation to create a new cluster in the same VPC and region using the default Run clustergroup. This will add a second cluster to the region based availability target you created above.
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.
all-regions.tanzu.vmware.com
to the new region based availability target created above.1
to 2
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:
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 created 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.
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:
Add the new Availability Target to the Space
1
replica.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:
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.