How to use Availability Targets

This topic tells you how to use Availability Targets on Tanzu Platform for Kubernetes.

Availability Targets are groupings of clusters that define where applications are scheduled. With Availability Targets, platform teams can abstract sets of clusters into logical groups that provide compute capacity without requiring their developers to know exactly which cluster their workload cluster is running on.

Create Availability Targets for your run environments

Clusters are automatically matched to the Availability Target based on rules and labels defined in the Availability Target. The best practice is to use cluster labels that match the label selectors for an Availability Target.

To create an Availability Target:

UI-based steps
Do the following in Tanzu Platform hub:
  1. On the left navigation pane, scroll down to Application Platform.
    1. Expand Application Spaces.
    2. Click Availability Targets
  2. Click Create Availability Targets > Step by Step.

    Create Availability Target steps.

  3. Provide a name for the Availability Target.
  4. (Optional) add a description for your Availability Target.
  5. In Cluster Mapping, ensure that Mapping Rules… is selected.
  6. Define the rules for selecting criteria that will belong to the Availability Target.
    1. In the first blank space, provide a the label key.
    2. In the second blank space, select a matching rule.
    3. In the the third blank space, provide the label values.
  7. (Optional) add more filtering rules for more complex inclusion or exclusion criteria.
  8. Click Create Availability Target.
Tanzu CLI-based steps
Use Tanzu CLI commands to install packages in the cluster group.
  1. Create a YAML file (example name: availabilitytarget.yaml) and include the following:

    apiVersion: spaces.tanzu.vmware.com/v1alpha1
    kind: AvailabilityTarget
    metadata:
     name: example-at
     description: "Availability Target example"
     namespace: default
    spec:
       affinity:
         clusterAffinity:
            clusterSelectorTerms:
            - matchExpressions:
                - key: topology.kubernetes.io/region
                  operator: In
                  values:
                     - <cluster-region>
    
    Flag Description
    name The name of the Availability Target. Names must be unique within the Project.
    description A human-readable description to provide additional information about the Availability Target.
    key A Kubernetes-compliant label name. The key must match the label on the clusters.
    operator The matching rule to use to define inclusion or exclusion criteria for clusters in the Availability Target. Acceptable values are In, Not In, Exists, Does Not Exist. If using Exists or Does Not Exist, the values field is not required.
    values A comma-separated list of values that are compared to the key to determine Availability Target cluster membership.
  2. Run the following Tanzu CLI command:

    tanzu availability-target create -f availabilitytarget.yaml
    
check-circle-line exclamation-circle-line close-line
Scroll to top icon