Day 2: Creating a AKS cluster using Azure CLI

I will write the set of commands through which i will create a simple AKS cluster using Azure CLI. So what i will do is

  • Login to Azure
  • Create a resource group
  • Create an AKS cluster
  • Verify from Azure portal

I will start by defining some variables that i will be using with my Powershell

$subscriptionid = 'SUBSCRIPTION_ID'

$aksClusterName = 'CLUSTER_NAME'

$aksClusterResourceGroup = 'CLUSTER_RESOURCE_GROUP'

$nodeCount = 'NUMBER_OD_NODES'

$resourceGroupLocation = 'RESOURCE_GROUP_LOCATION'

First I will login to azure and switch to the right subscription

  • az login
  • az account set --subscription $subscriptionid
  • az account show --output table

Then I will create the resource group in which my AKS cluster will be deployed.

az group create --location $resourceGroupLocation --name $aksClusterResourceGroup

Lastly I will launch the command to create the AKS cluster

az aks create --name $aksClusterName --resource-group $aksClusterResourceGroup --node-count $nodeCount --generate-ssh-keys

No after running this command it might take some time to create the cluster but once its done. We can go to Azure portal and verify if the cluster is created or not. I logged in to my Azure portal and search my newly created cluster and I can see its created.

Leave a Reply

Your email address will not be published. Required fields are marked *