sigs.k8s.io/cluster-api-provider-azure@v1.14.3/docs/book/src/topics/clusterclass.md (about) 1 # ClusterClass 2 3 - **Feature status:** Experimental 4 - **Feature gate:** `ClusterTopology=true` 5 6 [ClusterClass](https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-class/index.html) is a collection of templates that define a topology (control plane and machine deployments) to be used to continuously reconcile one or more Clusters. It is built on top of the existing Cluster API resources and provides a set of tools and operations to streamline cluster lifecycle management while maintaining the same underlying API. 7 8 CAPZ currently supports ClusterClass for both managed (AKS) and self-managed clusters. CAPZ implements this with four custom resources: 9 1. AzureClusterTemplate 10 2. AzureManagedClusterTemplate 11 3. AzureManagedControlPlaneTemplate 12 4. AzureManagedMachinePoolTemplate 13 14 Each resource is a template for the corresponding CAPZ resource. For example, the AzureClusterTemplate is a template for the CAPZ AzureCluster resource. The template contains a set of parameters that are able to be shared across multiple clusters. 15 16 ## Deploying a Self-Managed Cluster with ClusterClass 17 18 Users must first create a ClusterClass resource to deploy a self-managed cluster with ClusterClass. The ClusterClass resource defines the cluster topology, including the control plane and machine deployment templates. The ClusterClass resource also defines the parameters that can be used to customize the cluster topology. 19 20 Please refer to the Cluster API book for more information on how to write a ClusterClass topology: https://cluster-api.sigs.k8s.io/tasks/experimental-features/cluster-class/write-clusterclass.html 21 22 For a self-managed cluster, the AzureClusterTemplate defines the Azure infrastructure for the cluster. The following example shows a basic AzureClusterTemplate resource: 23 24 ```yaml 25 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 26 kind: AzureClusterTemplate 27 metadata: 28 name: capz-clusterclass-cluster 29 namespace: default 30 spec: 31 template: 32 spec: 33 location: westus2 34 networkSpec: 35 subnets: 36 - name: control-plane-subnet 37 role: control-plane 38 - name: node-subnet 39 natGateway: 40 name: node-natgateway 41 role: node 42 subscriptionID: 00000000-0000-0000-0000-000000000000 43 ``` 44 45 ## Deploying a Managed Cluster (AKS) with ClusterClass 46 47 **Feature gate:** `MachinePool=true` 48 49 Deploying an AKS cluster with ClusterClass is similar to deploying a self-managed cluster. However, both an AzureManagedClusterTemplate and AzureManagedControlPlaneTemplate must be used instead of the AzureClusterTemplate. Due to the nature of managed Kubernetes and the control plane implementation, the infrastructure provider (and therefore the AzureManagedClusterTemplate) for AKS cluster is basically a no-op. The AzureManagedControlPlaneTemplate is used to define the AKS cluster configuration, such as the Kubernetes version and the number of nodes. Finally, the AzureManagedMachinePoolTemplate defines the worker nodes (agentpools) for the AKS cluster. 50 51 The following example shows a basic AzureManagedClusterTemplate, AzureManagedControlPlaneTemplate, and AzureManagedMachinePoolTemplate resource: 52 53 ```yaml 54 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 55 kind: AzureManagedClusterTemplate 56 metadata: 57 name: capz-clusterclass-cluster 58 --- 59 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 60 kind: AzureManagedControlPlaneTemplate 61 metadata: 62 name: capz-clusterclass-control-plane 63 spec: 64 location: westus2 65 subscriptionID: 00000000-0000-0000-0000-000000000000 66 version: 1.25.2 67 --- 68 apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 69 kind: AzureManagedMachinePoolTemplate 70 metadata: 71 name: capz-clusterclass-pool0 72 namespace: default 73 spec: 74 template: 75 spec: 76 mode: System 77 name: pool0 78 sku: Standard_D2s_v3 79 ```