Deploy .NET Core Application In Azure Kubernetes With Azure DevOps

Introduction 

 
In this article, we will discuss how to deploy a .NET Core web apps in Azure Kubernetes with Azure devops. Deploying a .NET core application in Azure Kubernetes is very easy. In order to get better understanding of basic topics like Docker, Containers, Microservice and so on, I plan to provide a complete wrap of containerization and the use of it by deploying a new .NET Core web apps in Azure kubernetes with Azure DevOps.
 
I hope this article will be helpful to many new beginners who are new to .NET Core containerization, Docker, Azure Kubernetes and Azure devops. Let's learn and explore the important things that are neccesary for the future.
 
I am hearing the word containers everywhere, but I don't know what exactly it mean, to all those who have questions like  what is containers and why we need containers? The answers are given below.
 
Containers are nothing but a complete package of an application that contains your code, it's dependencies and all it's libraries. Just imagine a suitcase that holds all your belongings and that can be accessed anywhere, Containers do the same; because of this feature, an application runs fast and reliably from one computation enviornment to another.
 
I hope you got an answer for what is containers, now let's discuss Docker. 
 
Is it possible to club all my dependencies, libraries and my code in to a single package? If the answer is yes, then how it can be done? Yes, it can be done by Docker. Docker is nothing but a tool that is used to package software into containers. Containers are isolated from each other and they can communicate to each other through well defined channels.
 

Why we need containers?

 
The most important advantage of containerization is the containerized software runs same on all platform, regardless of infrastructure. 
 

How are containers and Azure Kubernetes related?

 
The next important doubt that comes after discussing the above topic is Azure Kubernetes. Just imagine  you had a package of software as container, You'll need a service  to build and deploy those packages (containerized software). Here comes Azure Jubernetes service to build and deploy a containerized application.
 
The main use of azure kubernetes is to act as a single platform to build, deliver and scale containerized application with confidence.
 
Let's deploy our new .NET Core web apps in Azure kubernetes with Azure DevOps.
 

Login to Azure portal and search Azure DevOps Starter

 
Azure DevOps starter is used to simplify the initial configuration of build and release pipiline in the Azure pipeline. For more details visit Devops starter.
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 

Choose the .NET sample application

 
Select either ASP.NET framework or .NET core framework. In this article, a demo of a .NET core application deployment is shown. 
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 

Azure Kubernetes Clusters

 
Enter the name of the project that you need to deploy in Azure Kubernetes. Choose an organization that already exist in your Azure devops or create new organization. Choose the region and node values. Click the additional settings to know more details about Azure Kubernetes clusters creation. Once done, click create.
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 
It creates a sample app in Azure devops organization. A build is executed and the sample app is deployed to azure. A dashboard view of an application that deployed to Azurekubernetes with its code repo, CI/CD pipeline are visible in Azure.  
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 
 A sample application that deployed contains all the dependencies, libraries and the docker file. It is visible in Azure devops. 
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 

CI/CD Pipeline 

 
Azure devops starter provides automatically configured CI/CD pipelines. Once build and release are success, we can see the sample application in azure portal with it's endpoint.
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 

Commit Changes 

 
Now commit changes to the existing application, here I changed the index file and redeployed. After building and releasing successfully, I can find the changes that I made in my application. 
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 
Output Obtained After the Commit 
 
Deploy .NET Core Application In Azure Kubernetes With Azure Devops
 
It's quiet easy to deploy your existing application either by cloning the sample app to your application or by connecting to git and deploying it into the Azure Kubernetes with Azuredevops. Hopefully, this article gives some basic and detailed idea of .NET core deployment. In my upcoming series of article we will discuss more about deploying on premise web apps in Azure Kubernetes by building and creating an image and using publish artifacts.