Setting Up a Kubernetes Cluster on AKS

Azure Kubernetes Services (AKS) manages the Kubernetes environment and provides options to quickly deploy the Kubernetes cluster. To enable a Kubernetes cluster to interact with other Azure resources, perform the steps mentioned in this section.

Before you beginSet up the Azure Container Registry and push the application Docker images to it, see Setting Up an Azure Container Registry.
    Procedure
  1. Create AKS Cluster through portal or CLI
  2. Note: Make a note of the Resource Group and Cluster Name parameters.
  3. Run the login command.
    az login
  4. To set trust relationship between AKS cluster and ACR, run the following command:
    az aks update -n myAKSCluster -g MyResourceGroup --attach-acr MyACRRegistry

    For example, attach AKS cluster to ACR by name pscregistry

     az aks update -n psccluster -g pscresourcegroup --attach-acr pscregistry

  5. Configure kubectl to connect your Kubernetes cluster by using the az aks get-credentials command.
    az aks kubernetes get-credentials --resource-group <resource_group_name> --name=<cluster_name>

    For example, get the access credentials for your cluster.

    az aks get-credentials --resource-group pscresourcegroup --name  psccluster

  6. View the dashboard for a Kubernetes cluster in a web browser.
    az aks browse --resource-group myResourceGroup --name myAKSCluster

    For example,

     az aks browse --resource-group pscresourcegroup --name psccluster

  7. Create binding for kubectl (Kubernetes command-line tool ) cluster role
    kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
  8. Verify the connection to your Kubernetes cluster by using the kubectl get nodes command.
    kubectl get nodes