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. If you are using the Ubuntu edition of the TKr, you must specify the full version string and you must include the OS annotation in the cluster spec. For more information on TKRs, see Administering Kubernetes Releases for TKG Service Clusters.

apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
  name: cluster-ubuntu
  namespace: tkg-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.25.7---vmware.3-fips.1-tkg.1
    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: tkg-storage-policy