azure aks – Run Kubectl command on AKS

First of all you need to install azure cli & kubectl on your system.

Install Azure Cli

Install Kubectl

As far kubectl is installed, verify its version

kubectl version --client --short
Client Version: v1.23.1

The version in your case might be different.

Now is the time to get AKS credentials (kubeconfig) file to interact with AKS cluster.

az login

provide the credentials for azure AD.

az account set --subscription {subscription_id}

az aks get-credentials --resource-group MyAKSResoucceGroup --name MyAksCluster

Verify if cluster is connected

 kubectl config current-context

You can play around with AKS and run all commands you want to run. Here is the cheatsheet or kubectl.

Kubectl Cheat-Sheet

Read more here: Source link