Refer to this example to provision a v1beta1 Cluster with default settings.

v1beta1 Example: Default Cluster

The following example YAML uses the v1beta1 API to create a default Cluster based on the default ClusterClass.

This example represents the minimum configuration required to create a Cluster using the v1beta1 API. The example is annotated with descriptions of each field. For more information, refer to the source code.

Note the following about this example:
  • Unlike the v1alpha3 API, the v1beta1 API requires you to specify the clusterNetwork. There is no default network setting for the Cluster type.
  • The default ClusterClass is tanzukubernetescluster which is documented here: Cluster v1beta1 API.
  • You can customize the Cluster using variables, each of which is a name-value pair. At a minimum you must specify the VM and storage classes as variables, as shown in the example.
  • Although technically optional, the example also includes a defaultStorageClass variable because many workloads, including Tanzu Packages and Helm charts, require the cluster be provisioned with a default storage class.
  • To write your own ClusterClass for TKG 2.0 clusters on Supervisor, refer to the KB article
kind: Cluster
#define the cluster
  #user-defined name of the cluster; string
  name: cluster-default
  #kubernetes namespace for the cluster; string
  namespace: tkg2-cluster-ns
#define the desired state of cluster
  #specify the cluster network; required, there is no default
    #network ranges from which service VIPs are allocated
      #ranges of network addresses; string array
      #CAUTION: must not overlap with Supervisor
      cidrBlocks: [""]
    #network ranges from which Pod networks are allocated
      #ranges of network addresses; string array
      #CAUTION: must not overlap with Supervisor
      cidrBlocks: [""]
    #domain name for services; string
    serviceDomain: "cluster.local"
  #specify the topology for the cluster
    #name of the ClusterClass object to derive the topology
    class: tanzukubernetescluster
    #kubernetes version of the cluster; format is TKR NAME
    version: v1.23.8---vmware.2-tkg.2-zshippable
    #describe the cluster control plane
      #number of control plane nodes; integer 1 or 3
      replicas: 3
    #describe the cluster worker nodes
      #specifies parameters for a set of worker nodes in the topology
        #node pool class used to create the set of worker nodes
        - class: node-pool
          #user-defined name of the node pool; string
          name: node-pool-1
          #number of worker nodes in this pool; integer 0 or more
          replicas: 3
    #customize the cluster
      #virtual machine class type and size for cluster nodes
      - name: vmClass
        value: guaranteed-medium
      #persistent storage class for cluster nodes
      - name: storageClass
        value: tkg2-storage-policy
      # default storageclass for control plane and worker node pools
      - name: defaultStorageClass
        value: tkg2-storage-policy