Once you've installed, open a new command prompt and sign in to your Azure account by running the following command:
Once you've installed, open a new terminal and sign in to your Azure account by running the following command:
Install AKS CLI
Kubernetes is a container orchestration platform. An orchestrator is responsible for running, distributing, scaling, and healing apps comprised of a collection of containers. Azure Kubernetes Service (AKS) provides Kubernetes as a managed service.
Run the following command to install the command-line tools for AKS:
az aks install-cli
You may be alerted with recommendations to set system PATH variables. These are not required for this tutorial.
Create Azure resources
Create a resource group
A resource group is used to organize a set of resources related to a single app.
Run the following command to create a resource group on the West US region:
az group create --name MyMicroserviceResources --location westus
If you want to use a different location on the previous command, you can run the following command to see which regions are available on your account and pick one closer to you:
az account list-locations -o table
If you want to use a different subscription for the session you can get a list of all subscriptions by running the following command:
az account list --all
Then you can run the following command to set a specific subscription for the session:
az account set -s NAME_OR_ID
Create an AKS cluster
Run the following command to create an AKS cluster in the resource group:
It's normal for this command to take several minutes to complete.
az aks create --resource-group MyMicroserviceResources --name MyMicroserviceCluster --node-count 1 --enable-addons http_application_routing --generate-ssh-keys
Run the following command to download the credentials to deploy to your AKS cluster:
az aks get-credentials --resource-group MyMicroserviceResources --name MyMicroserviceCluster
Deploy to Azure
Return to app directory
Since you opened a new command prompt in the previous step, you'll need to return to the directory you created your service in.
Since you opened a new terminal in the previous step, you'll need to return to the directory you created your service in.
Create a deployment file
The AKS tools use a .yaml file to define how to deploy your container.
Create a file called deploy.yaml with this command:
fsutil file createnew deploy.yaml 0
You can then open it in your favorite text editor.
You can then open it in your favorite text editor manually or with this command:
Replace the content of the deploy.yaml to the following in the text editor, making sure to replace [YOUR DOCKER ID] with your actual Docker ID.