Get started by installing a cluster with default configuration settings on Azure

This Quick Start guide provides simplified instructions for using DKP to get your Kubernetes cluster up and running with minimal configuration requirements on an Azure public cloud instances. To customize your Azure installation, refer to Azure Advanced installation.

Prerequisites

Before starting the DKP installation, verify that you have:

Configure Azure Prerequisites

Follow these steps:

  1. Log in to Azure:

    az login
    CODE

    [
      {
        "cloudName": "AzureCloud",
        "homeTenantId": "a1234567-b132-1234-1a11-1234a5678b90",
        "id": "b1234567-abcd-11a1-a0a0-1234a5678b90",
        "isDefault": true,
        "managedByTenants": [],
        "name": "Mesosphere Developer Subscription",
        "state": "Enabled",
        "tenantId": "a1234567-b132-1234-1a11-1234a5678b90",
        "user": {
          "name": "user@azuremesosphere.onmicrosoft.com",
          "type": "user"
        }
      }
    ]
    CODE

2. Create an Azure Service Principal (SP) by running the following command:

If an SP with the name exists, this command will rotate the password.

az ad sp create-for-rbac --role contributor --name "$(whoami)-konvoy" --scopes=/subscriptions/$(az account show --query id -o tsv)
CODE
{
  "appId": "7654321a-1a23-567b-b789-0987b6543a21",
  "displayName": "azure-cli-2021-03-09-23-17-06",
  "password": "Z79yVstq_E.R0R7RUUck718vEHSuyhAB0C",
  "tenant": "a1234567-b132-1234-1a11-1234a5678b90"
}
CODE

3. Set the required environment variables:

export AZURE_SUBSCRIPTION_ID="<id>"  		# b1234567-abcd-11a1-a0a0-1234a5678b90
export AZURE_TENANT_ID="<tenant>" 			# a1234567-b132-1234-1a11-1234a5678b90
export AZURE_CLIENT_ID="<appId>"  			# 7654321a-1a23-567b-b789-0987b6543a21
export AZURE_CLIENT_SECRET="<password>" 	# Z79yVstq_E.R0R7RUUck718vEHSuyhAB0C
CODE

4. Base64 encode the same environment variables:

export AZURE_SUBSCRIPTION_ID_B64="$(echo -n "${AZURE_SUBSCRIPTION_ID}" | base64 | tr -d '\n')"
export AZURE_TENANT_ID_B64="$(echo -n "${AZURE_TENANT_ID}" | base64 | tr -d '\n')"
export AZURE_CLIENT_ID_B64="$(echo -n "${AZURE_CLIENT_ID}" | base64 | tr -d '\n')"
export AZURE_CLIENT_SECRET_B64="$(echo -n "${AZURE_CLIENT_SECRET}" | base64 | tr -d '\n')"
CODE

Create a New Azure Kubernetes Cluster

If you use these instructions to create a cluster on Azure using the DKP default settings without any edits to configuration files or additional flags, your cluster will be deployed on an Ubuntu 20.04 operating system image with 3 control plane nodes, and 4 worker nodes.

The default Azure image is not recommended for use in production. We suggest using Konvoy Image Builder to create a custom image to take advantage of enhanced cluster operations, and to explore the advanced Azure installation topics for more options.

  1. Give your cluster a name suitable for your environment:

    export CLUSTER_NAME=azure-example
    CODE
  2. Create a Kubernetes cluster:

To increase Docker Hub's rate limit use your Docker Hub credentials when creating the cluster, by setting the following flag --registry-mirror-url=https://registry-1.docker.io --registry-mirror-username= --registry-mirror-password= on the dkp create cluster command.

dkp create cluster azure \
--cluster-name=${CLUSTER_NAME} \
--additional-tags=owner=$(whoami) \
--self-managed
CODE

You will see output similar to the following:

Generating cluster resources
cluster.cluster.x-k8s.io/azure-example created
azurecluster.infrastructure.cluster.x-k8s.io/azure-example created
kubeadmcontrolplane.controlplane.cluster.x-k8s.io/azure-example-control-plane created
azuremachinetemplate.infrastructure.cluster.x-k8s.io/azure-example-control-plane created
secret/azure-example-etcd-encryption-config created
machinedeployment.cluster.x-k8s.io/azure-example-md-0 created
azuremachinetemplate.infrastructure.cluster.x-k8s.io/azure-example-md-0 created
kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io/azure-example-md-0 created
clusterresourceset.addons.cluster.x-k8s.io/calico-cni-installation-azure-example created
configmap/calico-cni-installation-azure-example created
configmap/tigera-operator-azure-example created
clusterresourceset.addons.cluster.x-k8s.io/azure-disk-csi-azure-example created
configmap/azure-disk-csi-azure-example created
clusterresourceset.addons.cluster.x-k8s.io/cluster-autoscaler-azure-example created
configmap/cluster-autoscaler-azure-example created
clusterresourceset.addons.cluster.x-k8s.io/node-feature-discovery-azure-example created
configmap/node-feature-discovery-azure-example created
clusterresourceset.addons.cluster.x-k8s.io/nvidia-feature-discovery-azure-example created
configmap/nvidia-feature-discovery-azure-example created
CODE

As part of the underlying processing, the DKP CLI:

  • creates a bootstrap cluster

  • creates a workload cluster

  • moves CAPI controllers from the bootstrap cluster to the workload cluster, making it self-managed

  • deletes the bootstrap cluster

Explore the New Kubernetes Cluster

The kubeconfig file is written to your local directory and you can now explore the cluster.

  1. List the Nodes with the command:

    kubectl --kubeconfig=${CLUSTER_NAME}.conf get nodes
    CODE

    You will see output similar to:

    NAME                                 STATUS   ROLES                  AGE     VERSION
    azure-example-control-plane-84htt    Ready    control-plane,master   8m11s   v1.22.7
    azure-example-control-plane-r8srg    Ready    control-plane,master   4m17s   v1.22.7
    azure-example-control-plane-wrdql    Ready    control-plane,master   6m15s   v1.22.7
    azure-example-md-0-9crp9             Ready    <none>                 6m47s   v1.22.7
    azure-example-md-0-dvx5d             Ready    <none>                 6m42s   v1.22.7
    azure-example-md-0-gc9mx             Ready    <none>                 5m27s   v1.22.7
    azure-example-md-0-tkqf7             Ready    <none>                 4m48s   v1.22.7
    CODE
  2. List the Pods with the command:

    kubectl --kubeconfig=${CLUSTER_NAME}.conf get pods -A
    CODE

    You will see output similar to:

    NAMESPACE                           NAME                                                                 READY   STATUS    RESTARTS   AGE
    calico-system                       calico-typha-665d976df-rf7jg                                         1/1     Running   0          60m
    capa-system                         capa-controller-manager-697b7df888-vhcbj                             2/2     Running   0          57m
    capi-kubeadm-bootstrap-system       capi-kubeadm-bootstrap-controller-manager-67d8fc9688-5p65s           1/1     Running   0          57m
    capi-kubeadm-control-plane-system   capi-kubeadm-control-plane-controller-manager-846ff8b565-jqmhd       1/1     Running   0          57m
    capi-system                         capi-controller-manager-865fddc84c-9g7bb                             1/1     Running   0          57m
    cappp-system                        cappp-controller-manager-7859fbbb7f-xjh6k                            1/1     Running   0          56m
    ...
    CODE

Kommander Deployment

Deploy Kommander to the DKP Cluster:

./dkp install kommander --kubeconfig ${DKP_CLUSTER_NAME}.conf
CODE

If you would like to watch the Helm Releases Deploy, run the following command:

watch kubectl get hr -A --kubeconfig ${DKP_CLUSTER_NAME}.conf
CODE

Log in to the UI through Kommander

You can now log in to the UI to explore.

Delete the Kubernetes Cluster and Cleanup your Environment

Follow these steps:

Delete the provisioned Kubernetes cluster and wait a few minutes:

dkp delete cluster \
--cluster-name=${CLUSTER_NAME} \
--kubeconfig=${CLUSTER_NAME}.conf \
--self-managed
CODE

Similar to create cluster, use the flag --self-managed with the delete clustercommand:

  • Creates a bootstrap cluster.

  • Moves the CAPI controllers from the workload cluster back to the bootstrap cluster.

  • Deletes the workload cluster.

  • Deletes the bootstrap cluster.

To understand how this process works step by step, you can follow the workflow in Delete Azure Cluster.

To customize your Azure installation, refer to Azure Infrastructure installation.