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

v1beta1 Example: Custom Cluster Based on the Default ClusterClass

The following example YAML demonstrates how to use the v1beta1 API to provision a Cluster with several custom settings using variables. This example builds on the v1beta1 Example: Default Cluster.

The example uses variables to persitent volumes on worker nodes for high-churn components such as containerd and kubelet. In addition, vmClass variable is declared twice. The is vmClass variable declared in workers.machineDeployments overwrites the globally declared vmClass variable so that worker nodes are provisioned with a larger VM class.

Caution:

The IP addresses are examples only. You need to provide your own IP addresses suitable for your network environment.

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: cluster-custom
  namespace: tkg-cluster-ns
spec:
  clusterNetwork:
    services:
      cidrBlocks: ["10.196.0.0/12"]
    pods:
      cidrBlocks: ["192.168.0.0/16"]
    serviceDomain: "cluster.local"
  topology:
    class: tanzukubernetescluster
    version: v1.30.1---vmware.1-fips-tkg.5
    controlPlane:
      replicas: 3
    workers:
      machineDeployments:
        - class: node-pool
          name: node-pool-1
          replicas: 3
          variables:
            overrides:
            - name: vmClass
              value: guaranteed-xlarge
    variables:
      - name: vmClass
        value: guaranteed-medium
      - name: storageClass
        value: tkg-storage-profile
      - name: defaultStorageClass
        value: tkg-storage-profile
      - name: nodePoolVolumes
        value:
          - name: containerd
            capacity:
              storage: 50Gi
            mountPath: /var/lib/containerd
            storageClass: tkg-storage-profile
          - name: kubelet
            capacity:
              storage: 50Gi
            mountPath: /var/lib/kubelet
            storageClass: tkg-storage-profile