Saturday, February 9, 2019

Create Azure Kubernetes Cluster Using Azure CLI


This post explains how to deploy a kubernetes cluster using Azure CLI (Command Line Interface). Let's look at the steps.

  • Install the Azure CLI. Find the installation details from this location.(https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest)
  • After installation completed, open windows PowerShell.
  • Type az login command to login to your Azure subscription.
  • A browser window will prompt for you to login. Enter your Azure subscription credentials and login.
  • After login succeed, list of all the subscriptions which you have access will be displayed in the PowerShell window.

Create Kubernetes cluster with required parameters.

Following are the required parameters

-n  Name of the managed cluster

-g  Resource group


If you have more than one Azure subscription give the subscription id. Otherwise you may get different issues when try to create an AKS cluster.

Other than these two required parameters you have to provide or generate SSH key.SSH key is used to access AKS nodes. AKS nodes are Linux VMs and not exposed to the internet.You may need to access an AKS nodes for different reasons like maintenance or troubleshoot operations.

Following image shows how to create an AKS cluster named DemoCluster inside resource group named ACRgroup 

Command : az aks create -n DemoCluster -g ACRgroup --subscription mysubscription_id --generate-ssh-keys



If AKS cluster has created without any issues you will be able to see a message similar to shown in the following image




If you need to create a cluster without SSH key, you can create an AKS cluster without a SSH key by adding –x (--no-ssh-key) to the end of CLI command.





After you get AKS cluster creation succeed message, go to Azure portal and search for DemoCluster. You can find the name of newly created AKS cluster among search results.















Click on DemoCluster and you will be able to see cluster details.









Other than required parameters you can provide several other optional parameters with az aks create CLI command and customize AKS cluster according to your project requirements. You can find more details from here (https://docs.microsoft.com/en-us/cli/azure/aks?view=azure-cli-latest)

No comments:

Post a Comment