Setting Up a Kubernetes Cluster on AKS
Azure Kubernetes Services (AKS) manages the Kubernetes environment and provides options to quickly deploy Kubernetes cluster. To enable a Kubernetes cluster to interact with other Azure resource, 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
- Create AKS Cluster through portal or CLI
- Run the
login
command.az login
- 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
mdmregistry
az aks update -n mdmcluster -g mdmresourcegroup --attach-acr mdmregistry
- Configure
kubectl
to connect your Kubernetes cluster by using theaz 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 mdmresourcegroup --name mdmcluster
- 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 mdmresourcegroup --name mdmcluster
- Create binding for kubectl (Kubernetes command-line tool ) cluster role
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
- Verify the connection to your Kubernetes cluster by using the
kubectl get nodes
command.kubectl get nodes
Note: Make a note of the Resource Group and Cluster Name parameters.
What to do next