Introduction
Azure Kubernetes Service (AKS) simplifies deploying, managing, and scaling containerized applications using Kubernetes on Azure. This quickstart guides you through deploying a sample web application to an AKS cluster.
Prerequisites
Before you begin, ensure you have the following:
- An Azure account. If you don't have one, you can create a free account.
- Azure CLI installed. Install Azure CLI.
- Kubectl installed. Install Kubectl.
Steps
-
Create an AKS Cluster
Use the Azure CLI to create a managed Kubernetes cluster. This command creates a new resource group and an AKS cluster within it. The deployment may take a few minutes.
az group create --name myResourceGroup --location eastus az aks create --resource-group myResourceGroup --name myAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keysThis command creates a cluster with one node. You can adjust the node count as needed.
-
Connect to the Cluster
Configure kubectl to connect to your AKS cluster. This command downloads credentials and sets the context for kubectl.
az aks get-credentials --resource-group myResourceGroup --name myAKSClusterVerify the connection by listing the nodes in your cluster:
kubectl get nodes -
Deploy a Sample Application
For this quickstart, we'll deploy a simple Azure Boards sample application. The application manifest is stored in a remote YAML file.
kubectl create deployment azure-vote-back --image=mcr.microsoft.com/azuredocs/azure-vote-back kubectl create service clusterip azure-vote-back --tcp 80:80Next, deploy the front-end application:
kubectl create deployment azure-vote-front --image=mcr.microsoft.com/azuredocs/azure-vote-front --uses=azure-vote-back --port 80 kubectl create service loadbalancer azure-vote-front --publish 80:80 --uses azure-vote-front -
Test the Application
Get the external IP address of the load balancer service:
kubectl get service azure-vote-frontLook for the EXTERNAL-IP address and open it in your web browser.
Tip: It might take a minute or two for the external IP address to be assigned. If the IP address is still pending, run the command again in a few moments. -
Clean up Resources
To avoid ongoing charges, delete the resource group and all its contained resources.
az group delete --name myResourceGroup --yes --no-wait
Next Steps
Congratulations! You have successfully deployed an application to Azure Kubernetes Service. You can now explore more advanced topics:
Explore More AKS Tutorials