Create a New AKS Cluster
![](../../__attachments/89360826/Enterprise_50%25.png?inst-v=fbc98f0a-f9ae-4d4c-828f-dc0defe966ca)
DKP to create a new AKS cluster
Ensure that the KUBECONFIG
environment variable is set to the self-managed cluster by running export KUBECONFIG={SELF_MANAGED_AZURE_CLUSTER}.conf
Create a new AKS Kubernetes cluster
Set the environment variable to a name for this cluster.
CODEexport CLUSTER_NAME=aks-example
See Get Started with AKS for information on naming your cluster.
Check to see what version of Kubernetes is available in your region. When deploying with AKS, you need to declare the version of Kubernetes you wish to use by running the following command, substituting
<your-location>
for the Azure region you're deploying to:CODEaz aks get-versions -o table --location <your-location>
Set the version of Kubernetes you’ve chosen:
NOTE: Using Kubernetes v1.23.x is recommended. The version listed in the command is an example.CODEexport KUBERNETES_VERSION=1.23.5
Create the cluster:
CODEdkp create cluster aks --cluster-name=${CLUSTER_NAME} --additional-tags=owner=$(whoami) --kubernetes-version=${KUBERNETES_VERSION}
CODEGenerating cluster resources cluster.cluster.x-k8s.io/aks-example created azuremanagedcontrolplane.infrastructure.cluster.x-k8s.io/aks-example created azuremanagedcluster.infrastructure.cluster.x-k8s.io/aks-example created machinepool.cluster.x-k8s.io/aks-example created azuremanagedmachinepool.infrastructure.cluster.x-k8s.io/cp6dsz8 created machinepool.cluster.x-k8s.io/aks-example-md-0 created azuremanagedmachinepool.infrastructure.cluster.x-k8s.io/mp6gglj created clusterresourceset.addons.cluster.x-k8s.io/cluster-autoscaler-aks-example created configmap/cluster-autoscaler-aks-example created clusterresourceset.addons.cluster.x-k8s.io/node-feature-discovery-aks-example created configmap/node-feature-discovery-aks-example created clusterresourceset.addons.cluster.x-k8s.io/nvidia-feature-discovery-aks-example created configmap/nvidia-feature-discovery-aks-example created
Inspecting or editing the cluster objects
Use your favorite editor.
NOTE: Editing the cluster objects requires some understanding of Cluster API. Edits can prevent the cluster from deploying successfully.
The objects are Custom Resources defined by Cluster API components, and they belong in three different categories:
Cluster
A Cluster object has references to the infrastructure-specific and control plane objects.
Control Plane
Node Pool
A Node Pool is a collection of machines with identical properties. For example, a cluster might have one Node Pool with large memory capacity, another Node Pool with GPU support. Each Node Pool is described by three objects: The MachinePool references an object that describes the configuration of Kubernetes components (for example, kubelet) deployed on each node pool machine, and an infrastructure-specific object that describes the properties of all node pool machines. Here, it references a KubeadmConfigTemplate.
For in-depth documentation about the objects, read Concepts in the Cluster API Book.
Wait for the cluster control-plane to be ready:
CODEkubectl wait --for=condition=ControlPlaneReady "clusters/${CLUSTER_NAME}" --timeout=20m
CODEcluster.cluster.x-k8s.io/aks-example condition met
The
READY
status will becomeTrue
after the cluster control-plane becomes ready.Once the objects are created on the API server, the Cluster API controllers reconcile them. They create infrastructure and machines. As they progress, they update the Status of each object. DKP provides a command to describe the current status of the cluster:
CODEdkp describe cluster -c ${CLUSTER_NAME}
CODENAME READY SEVERITY REASON SINCE MESSAGE Cluster/aks-example True 48m ├─ClusterInfrastructure - AzureManagedCluster/aks-example └─ControlPlane - AzureManagedControlPlane/aks-example
As they progress, the controllers also create Events. List the Events using this command:
CODEkubectl get events | grep ${CLUSTER_NAME}
For brevity, the example uses
grep
. It is also possible to use separate commands to get Events for specific objects. For example,kubectl get events --field-selector involvedObject.kind="AKSCluster"
andkubectl get events --field-selector involvedObject.kind="AKSMachine"
.CODE48m Normal SuccessfulSetNodeRefs machinepool/aks-example-md-0 [{Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000000 UID:e3c30389-660d-46f5-b9d7-219f80b5674d APIVersion: ResourceVersion: FieldPath:} {Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000001 UID:300d71a0-f3a7-4c29-9ff1-1995ffb9cfd3 APIVersion: ResourceVersion: FieldPath:} {Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000002 UID:8eae2b39-a415-425d-8417-d915a0b2fa52 APIVersion: ResourceVersion: FieldPath:} {Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000003 UID:3e860b88-f1a4-44d1-b674-a54fad599a9d APIVersion: ResourceVersion: FieldPath:}] 6m4s Normal AzureManagedControlPlane available azuremanagedcontrolplane/aks-example successfully reconciled 48m Normal SuccessfulSetNodeRefs machinepool/aks-example [{Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000000 UID:e3c30389-660d-46f5-b9d7-219f80b5674d APIVersion: ResourceVersion: FieldPath:} {Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000001 UID:300d71a0-f3a7-4c29-9ff1-1995ffb9cfd3 APIVersion: ResourceVersion: FieldPath:} {Kind: Namespace: Name:aks-mp6gglj-41174201-vmss000002 UID:8eae2b39-a415-425d-8417-d915a0b2fa52 APIVersion: ResourceVersion: FieldPath:}]
Known Limitations
NOTE: Be aware of these limitations in the current release of DKP.
The DKP version used to create a workload cluster must match the DKP version used to create a workload cluster.
DKP supports deploying one workload cluster.
DKP generates a single nodepool is deployed by default, but you can add additional nodepools.
DKP does not validate edits to cluster objects.
When complete, you can explore the new cluster.