Cloud Infrastructure Community's Space

Connect to Azure Kubernetes Cluster (AKS)

Azure Kubernetes Service (AKS) is a managed Kubernetes service that lets you quickly deploy and manage clusters. In this quickstart, you will:

  • Deploy an AKS cluster using the Azure CLI.
  • Run a sample multi-container application with a web front-end and a Redis instance in the cluster.

Prerequisites

You can use either the Azure Cloud Shell or a local Azure CLI.

  • This article requires version 2.0.64 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
  • The identity you are using to create your cluster has the appropriate minimum permissions. For more details on access and identity for AKS, see Access and identity options for Azure Kubernetes Service (AKS).
  • If you have multiple Azure subscriptions, select the appropriate subscription ID in which the resources should be billed using the az account command.

Connect to AKS cluster

Make sure you have Azure CLI installed on your working machine, open terminal and connect to the Azure Cloud with command:

az login -t <your Azure AD directory ID>

Set default subscription if you have multiple subscription in the Azure Cloud, this subscription must contains your AKS cluster.

az account set -s <your aks cluster's subscriptions>

And get AKS context with command

az aks get-credentials -n <your aks name> -g <your aks resource group>

After getting the AKS context, you can easily switch your kubectl to start working with your AKS cluster with

kubectl config use-context <your aks name. as k8s context>

Press ESC to close