Refer to this example to provision a v1beta1 Cluster that uses the Ubuntu edition of a Tanzu Kubernetes release.

v1beta1 Example: Cluster with Ubuntu TKR

The following example YAML demonstrates how to use the v1beta1 API to provision a Cluster that uses the Ubuntu edition of the specified TKR. This example builds on the v1beta1 Example: Default Cluster.

By default PhotonOS is used for cluster nodes. If the TKR version supports multiple OSImages, include the annotation run.tanzu.vmware.com/resolve-os-image: os-name=ubuntu in the cluster spec to use Ubuntu instead of Photon. For more information on TKRs, see Administering Tanzu Kubernetes Releases for TKG 2.0 Clusters on Supervisor.

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: cluster-ubuntu
  namespace: tkg2-cluster-ns
spec:
  clusterNetwork:
    services:
      cidrBlocks: ["198.51.100.0/12"]
    pods:
      cidrBlocks: ["192.0.2.0/16"]
    serviceDomain: "cluster.local"
  topology:
    class: tanzukubernetescluster
    version: v1.23.8+vmware.2-tkg.2-zshippable
    controlPlane:
      replicas: 3
      metadata:
        annotations:
          run.tanzu.vmware.com/resolve-os-image: os-name=ubuntu
    workers:
      machineDeployments:
        - class: node-pool
          name: node-pool-1
          replicas: 3
          metadata:
            annotations:
              run.tanzu.vmware.com/resolve-os-image: os-name=ubuntu
        - class: node-pool
          name: node-pool-2
          replicas: 3
          metadata:
            annotations:
              run.tanzu.vmware.com/resolve-os-image: os-name=ubuntu
        - class: node-pool
          name: node-pool-3
          replicas: 3
          metadata:
            annotations:
              run.tanzu.vmware.com/resolve-os-image: os-name=ubuntu
    variables:
      - name: vmClass
        value: guaranteed-medium
      - name: storageClass
        value: tkg2-storage-policy