As you already have a AKS cluster that you are managing from Azure CLI. I guess you have followed instructions as per this document.
Once the AKS cluster is setup you must have used the below command to get the AKS cluster credentials and then user kubectl
for managing your AKS cluster.
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster
The above command saves the config under ~/.kube/config
file in shell. You can also specify a different location for AKS config file using --file
.
Managing multiple AKS clusters from CLI:
- Once you setup another AKS cluster use
az aks list -o table
command and get the list of clusters. - Get the credentials to the new cluster by using the
az aks get-credentials
command. - Now, you can use
kubectl config get-contexts
to see all AKS clusters you are authenticated to. - The list indicates an * against the cluster that your
kubectl
commands are running. - To switch to another cluster and manage (run commands) against it, you can use
kubectl config use-context <yourClusterName>
.
Hope the provided information is helpful.
Please 'Accept as answer' if the provided information is helpful, so that it can help others in the community looking for help on similar topics.