Introduction
This article is the continuation of the three series article where we are trying to learn and get hands-on with Azure Kubernetes Services. In the last article, we created an ASP.NET Core application and containerized it with Docker. We created the local image of the application and tested it locally. In this article, we’ll deploy that image to local Kubernetes cluster.
Thesis
In this article, we'll demonstrate how to orchestrate the deployment and scaling of an entire ASP.NET Core application using Docker and Azure Kubernetes Services. The entire article will be divided into three parts as follows.
- Learning Azure Kubernetes Services – Day One: Containerize ASP.NET Core Applications with Docker
- Learning Azure Kubernetes Services – Day Two: Deploy ASP.NET Core Applications on local Kubernetes Cluster
- Learning Azure Kubernetes Services – Day Three: Deploying ASP.NET Core Application to Azure Kubernetes Services
Before we start there are some pre-requisites to be taken care of. Along with an Azure account, make sure the following things are installed on the development machine.
- Git for Windows.
- .Net Core 2.1 or above.
- Azure CLI
- Azure PowerShell
After Azure CLI installation, run the following command (az --version) to make sure the CLI is up and running.
The reader of this article is expected to have followed the last article as this is the continuation article.
Deploy on Local Kubernetes Cluster
There are two approaches to deploy the image on local Kubernetes cluster i.e. running on developers’ machine. Make sure Kubernetes is installed and running. You can check the version by kubectl version --short command.

Interactive approach
Run the kubectl run command. Run Kubectl followed by the name of a deployment<aks-deployment>, followed by the --image <ask:local>, then follow that with the --port switch and specify 80, which is the port our containers expose our application. The --replica switch to specify that 3 replicas are needed for the application.

When command is executed, a deployment is created where the desired state is set to three replicas.

Next, a replica set is created that ensures that there are always three replicas of the application running.

The scheduler schedules the pod deployment on the worker node, which commands the Docker engine running on the worker node to pull the image and then run in pods.














Abhishek SahuPosted Apr 20, 2021, 3:19 PM
Excellent explanation of AKS step by step.