how to access second AKS from shell

sunny biswas 21 Reputation points
2021-01-04T18:47:58.55+00:00

I have created a AKS cluster , using the CLI/Shell in azure. I am running commands from the shell and administering the AKS cluster.

I want to create another cluster. But I am not sure how to access new cluster from the shell.

Any direction will be helpful.

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,073 questions
{count} votes

Accepted answer
  1. vipullag-MSFT 26,211 Reputation points
    2021-01-05T05:31:08.293+00:00

    @sunny biswas

    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:

    1. Once you setup another AKS cluster use az aks list -o table command and get the list of clusters.
    2. Get the credentials to the new cluster by using the az aks get-credentials command.
    3. Now, you can use kubectl config get-contexts to see all AKS clusters you are authenticated to.
    4. The list indicates an * against the cluster that your kubectl commands are running.
    5. 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.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.