The Cluster v1beta1 API lets you provision a Cluster based on a default ClusterClass definition.
ClusterClass API v1beta1
The Kubernetes Cluster API is a suite of tools which provide for the declarative provisioning, upgrading, and operating of Kubernetes clusters. ClusterClass is an evolution of the Cluster API that lets you define templates for managing the life cycle of sets of clusters. TKG 2 on Supervisor supports ClusterClass using the v1beta1 API.
TKG 2 on Supervisor ships with a default ClusterClass definition named tanzukubernetescluster
. The tanzukubernetescluster
ClusterClass provides the template for TKG 2 cluster creation on Supervisor using the v1beta API. The tanzukubernetescluster
ClusterClass is available in all user namespaces. To create a cluster based on this ClusterClass, reference it in the Cluster specification. Refer to the v1beta examples for guidance.
Default ClusterClass tanzukubernetescluster
tanzukubernetescluster
ClusterClass is immutable. It is provided here as reference.
apiVersion: cluster.x-k8s.io/v1beta1 kind: ClusterClass metadata: name: tanzukubernetescluster annotations: run.tanzu.vmware.com/resolve-tkr: "" spec: controlPlane: metadata: annotations: run.tanzu.vmware.com/resolve-os-image: os-name=photon ref: apiVersion: controlplane.cluster.x-k8s.io/v1beta1 kind: KubeadmControlPlaneTemplate name: "tkc-control-plane" machineInfrastructure: ref: kind: VSphereMachineTemplate apiVersion: vmware.infrastructure.cluster.x-k8s.io/v1beta1 name: "tkc-control-plane" machineHealthCheck: maxUnhealthy: 100% nodeStartupTimeout: 2h0m0s unhealthyConditions: - status: Unknown timeout: 5m0s type: Ready - status: "False" timeout: 12m0s type: Ready infrastructure: ref: apiVersion: vmware.infrastructure.cluster.x-k8s.io/v1beta1 kind: VSphereClusterTemplate name: "tkc-infrastructure" workers: machineDeployments: - class: node-pool template: metadata: annotations: run.tanzu.vmware.com/resolve-os-image: os-name=photon bootstrap: ref: kind: KubeadmConfigTemplate apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 name: "tkc-md" infrastructure: ref: kind: VSphereMachineTemplate apiVersion: vmware.infrastructure.cluster.x-k8s.io/v1beta1 name: "tkc-md" machineHealthCheck: maxUnhealthy: 100% nodeStartupTimeout: 2h0m0s unhealthyConditions: - status: Unknown timeout: 5m0s type: Ready - status: "False" timeout: 12m0s type: Ready variables: - name: TKR_DATA required: false schema: openAPIV3Schema: type: object additionalProperties: type: object properties: kubernetesSpec: type: object properties: version: type: string imageRepository: type: string etcd: type: object properties: imageTag: type: string coredns: type: object properties: imageTag: type: string osImageRef: type: object properties: name: type: string labels: type: object additionalProperties: type: string - name: vmClass required: true schema: openAPIV3Schema: type: string - name: storageClass required: true schema: openAPIV3Schema: type: string - name: storageClasses required: false schema: openAPIV3Schema: type: array items: type: string - name: defaultStorageClass required: false schema: openAPIV3Schema: type: string - name: extensionCert required: false schema: openAPIV3Schema: type: object properties: contentSecret: type: object properties: name: type: string key: type: string - name: clusterEncryptionConfigYaml required: false schema: openAPIV3Schema: type: string - name: defaultRegistrySecret required: false schema: openAPIV3Schema: type: object properties: namespace: type: string name: type: string data: type: string - name: ntp required: false schema: openAPIV3Schema: type: string - name: user required: false schema: openAPIV3Schema: type: object properties: passwordSecret: type: object properties: name: type: string key: type: string sshAuthorizedKey: type: string - name: nodePoolTaints required: false schema: openAPIV3Schema: type: array items: type: object properties: key: type: string value: type: string effect: type: string timeAdded: type: integer - name: nodePoolLabels required: false schema: openAPIV3Schema: type: array items: type: object properties: key: type: string value: type: string - name: proxy required: false schema: openAPIV3Schema: type: object properties: httpProxy: type: string httpsProxy: type: string noProxy: type: array items: type: string - name: trust required: false schema: openAPIV3Schema: type: object properties: additionalTrustedCAs: type: array items: type: object properties: name: type: string - name: controlPlaneVolumes required: false schema: openAPIV3Schema: type: array items: type: object properties: storageClass: type: string mountPath: type: string name: type: string capacity: type: object properties: storage: type: string - name: nodePoolVolumes required: false schema: openAPIV3Schema: type: array items: type: object properties: storageClass: type: string mountPath: type: string name: type: string capacity: type: object properties: storage: type: string
ClusterClass Variables for Customizing a Cluster
You customize a Cluster based on the tanzukubernetescluster
ClusterClass using variables. Variables are defined using name-values pairs. The syntax must conform to the openAPIV3Schema.
- VM class
- Storage class
- Proxy
- TLS Certificates
- SSH keys
The following lists all variables that are available with the default tanzukubernetescluster
.
-
TKR_DATA
- Object that you use to specify the TKR version and other details.
-
vmClass
- Required string that maps to the name of a VM class that is bound to the vSphere Namespace where the TKG cluster is provisioned.
-
storageClass
-
String that is the name of a vSphere storage profile that has been assigned to the
vSphere Namespace where the TKG cluster is provisioned.
... variables: - name: storageClass value: tkg2-storage-profile
-
storageClasses
-
Array of one or more strings, each string being the name of a vSphere storage profile that has been assigned to the
vSphere Namespace where the TKG cluster is provisioned.
... variables: - name: storageClasses value: [tkg2-storage-profile, tkg2-storage-profile-latebinding]
-
defaultStorageClass
-
String that identifies which storage class to use as the default storage class, often required by certain applications such as Helm charts and Tanzu Packages.
... variables: - name: defaultStorageClass value: tkg2-storage-profile
-
extensionCert
-
Object containing a
contentSecret
object containingname
andkey
strings. ThecontentSecret
references a Kubernetes secret object that has been created for a TLS certificate.... variables: #extensionCert specifies the cert and key for Extensions Controller #self-signed issuer and certificates must be created in advance - name: extensionCert value: contentSecret: #name specifies the name of secret name: string #key specifies the content of tls\.crt in the secret's data map key: string
-
clusterEncryptionConfigYaml
- String which is a YAML file that provides encryption configuration details.
-
defaultRegistrySecret
- Object that includes a public key, certificate name, and namespace for a default container registry.
-
ntp
- String which is the FQDN or IP address of an NTP server.
-
user
- Object that includes a passwordSecret object, with name and key strings, and sshAuthorizedKey string. You can use this variable to add a user's SSH key to cluster nodes for remote SSH access.
-
nodePoolTaints
- Array of objects, each object contains a taint that applies to worker nodes.
-
nodePoolLabels
- Array of one or more objects, each object containing a key/value pair, both of which are strings.
-
proxy
- Object with parameters that reference a proxy server for outbound cluster connections.
-
trust
- Object for adding TLS certificates to the Cluster, either additional CAs or end certificates.
-
controlPlaneVolumes
-
Optional array of objects, each of which includes
name
,storageClass
, andmountPath
, each of which are strings, and an optionalcapacity
object that includes astorage
string.... variables: #controlPlaneVolumes is an optional set of PVCs to create and #attach to each node; use for high-churn components like etcd - name: controlPlaneVolumes value: | #name of the PVC to be used as the suffix (node.name) - name: etcd #mountPath is the directory where the volume device is mounted #takes the form /dir/path mountPath: /var/lib/etcd #storageClass is the storage class to use for the PVC storageClass: tkg2-storage-profile #capacity is the PVC storage capacity capacity: #storage sets the capacity for the disk volume #if not specified defaults to storageClass capacity storage: 4Gi
-
nodePoolVolumes
-
Optional array of objects, each of which includes
name
,storageClass
, andmountPath
, each of which are strings, and an optionalcapacity
object that includes astorage
string.... variables: #nodePoolVolumes is an optional set of PVCs to create and #attach to each node; use for high-churn components like containerd - name: nodePoolVolumes value: | #name of the PVC to be used as the suffix (node.name) - name: etcd #mountPath is the directory where the volume device is mounted #takes the form /dir/path mountPath: /var/lib/containerd #storageClass is the storage class to use for the PVC storageClass: tkg2-storage-profile #capacity is the PVC storage capacity capacity: #storage sets the capacity for the disk volume #if not specified defaults to storageClass capacity storage: 4Gi