How to use Availability Targets

Availability Targets are groupings of clusters that define where applications will be 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 on the 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. Optionally, add a description for your availability target.
  5. In Cluster Mapping, ensure Mapping Rules… is selected.
  6. Define the rules for selecting criteria that will belong to the Availability Target.
    1. In the first blank, provide a the label key.
    2. In the second blank, select a matching rule.
    3. In the the third blank, provide the label values.
  7. Optionally, 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 with the following, for example, availabilitytarget.yaml.

    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 apply -f availabilitytarget.yaml
    
check-circle-line exclamation-circle-line close-line
Scroll to top icon