Deploying a Cluster in AKS using Kubernetes

  1. Login into Azure. Execute the following command and follow the instructions.
    az login
  2. Set the subscription account that you want to use.
    azaccountset--subscription <subscriptionID>
  3. Create a resource group for K8S cluster using the following command:
    az group create --name <resourceGroupName> --location eastus
    Note: To see the availability of AKS according to region, refer to this chart: https://azure.microsoft.com/en-us/global-infrastructure/services/.
  4. Create a container registry inside the resource group created in step 3:
    az acr create --resource-group <resourceGroupName> --name <acrName> --sku Basic
    Sample output of the create container registry command:
    az acr create --resource-group ml5AKS --name ml5acreast --sku Basic
    
    {
    
      "adminUserEnabled": false,
    
      "creationDate": "2018-10-16T19:04:25.870380+00:00",
    
      "id": "/subscriptions/<subscriptionID>/resourceGroups/ashishAKS/providers/Microsoft.ContainerRegistry/registries/ml5acreast",
    
      "location": "eastus",
    
      "loginServer": "ml5acreast.azurecr.io",
    
      "name": "ml5acreast",
    
      "provisioningState": "Succeeded",
    
      "resourceGroup": "ml5AKS",
    
      "sku": {
    
        "name": "Basic",
    
        "tier": "Basic"
    
      },
    
      "status": null,
    
      "storageAccount": null,
    
      "tags": {},
    
      "type": "Microsoft.ContainerRegistry/registries"
    
    }
    Note: If the above command prompts you to create the service principal or assign the appID to the existing principal, follow these instructions, and then retry creating the registry.
    To create a new service principal and assign access, run the following command:
    az ad sp create-for-rbac --scopes
    /subscriptions/<subscriptionID>/resourceGroups/< resourceGroupName>/providers/Microsoft.ContainerRegistry/registries/ <acrName> --role Owner --password
    <password>
    To use an existing service principal and assign access, run the following command:
    az role assignment create --scope
    /subscriptions//<subscriptionID>/resourceGroups/< resourceGroupName>/providers/Microsoft.ContainerRegistry/registries/ <acrName> --role Owner --assignee
    <app-id>
    To find the appId of an existing service principal from the output, run the following command:
    az ad sp list --display-name
    <servicePrincipalName> | grep appId
  5. Login into container registry:
    az acr login --name <acrName>
  6. Go to the Azure portal and create K8S cluster as shown below. Click Add, fill the required details and follow the instructions.
    Note: Select the resource group you created in Step 3 and Kubernetes version as 1.10.7. Select Node size and count as desired. Recommended is 4 core CPU with 16GB Memory.


  7. After successful creation, you will find container registry and k8s cluster under the resource group as shown below.

Install the Kubernetes Dashboard UI

To install the Kubernetes Dashboard UI:
  1. Configure kubectl to connect this cluster.
    az aks get-credentials --resource-group <resource_group_name> --name <k8s_cluster_name>
    The output from the first command should look like below.
    Merged "ml5-single" as current context in /Users/Ashkumar/.kube/config
    This is must before going further.
  2. Open another terminal and run the following command to start dashboard:
    az aks browse --resource-group <resource_group_name> --name <k8s_cluster_name>