Skip to main content
Skip table of contents

Create a New AKS Cluster

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

  1. Set the environment variable to a name for this cluster.

    CODE
    export CLUSTER_NAME=aks-example

    See Get Started with AKS for information on naming your cluster.

  2. 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:

    CODE
    az aks get-versions -o table --location <your-location>
  3. Set the version of Kubernetes you’ve chosen:
    NOTE: Using Kubernetes v1.24.x is recommended. The version listed in the command is an example.

    CODE
    export KUBERNETES_VERSION=1.24.6
  4. Create the cluster:

    CODE
    dkp create cluster aks --cluster-name=${CLUSTER_NAME} --additional-tags=owner=$(whoami) --kubernetes-version=${KUBERNETES_VERSION}

    If your environment uses HTTP/HTTPS proxies, you must include the flags --http-proxy, --https-proxy, and --no-proxy and their related values in this command for it to be successful. More information is available in Configure HTTP Proxy.

    CODE
    Generating 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.

  1. Wait for the cluster control-plane to be ready:

    CODE
    kubectl wait --for=condition=ControlPlaneReady "clusters/${CLUSTER_NAME}" --timeout=20m

    CODE
    cluster.cluster.x-k8s.io/aks-example condition met

    The READY status will become True after the cluster control-plane becomes ready.

  2. 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:

    CODE
    dkp describe cluster -c ${CLUSTER_NAME}

    CODE
    NAME                                                       READY  SEVERITY  REASON  SINCE  MESSAGE
    Cluster/aks-example                                        True                     48m
    ├─ClusterInfrastructure - AzureManagedCluster/aks-example
    └─ControlPlane - AzureManagedControlPlane/aks-example
  3. As they progress, the controllers also create Events. List the Events using this command:

    CODE
    kubectl 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" and kubectl get events --field-selector involvedObject.kind="AKSMachine".

    CODE
    48m         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.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.