azure aks – Run Kubectl command on AKS

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

Install Azure Cli
learn.microsoft.com/en-us/cli/azure/install-azure-cli

Install Kubectl
kubernetes.io/docs/tasks/tools/

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
  MyAksCluster

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

Kubectl Cheat-Sheet
www.bluematador.com/learn/kubectl-cheatsheet

Read more here: Source link