Monday, September 14, 2020

Deploying dockerized .net microservice to Kubernetes cluster using Azure DevOps YAML pipeline

In my previous blog

I created the Azure Container Registry and Kubernetes cluster using Terraform and Azure DevOps. I would encourage you to read my previous blog first before reading this.

In this blog, I will show you how to import a docker image into the Azure Container registry and deploy the application in the Kubernetes cluster using the Azure DevOps YAML pipeline. The complete architectural flow is as below:

I am using .net sample application that I had been using in my previous blogs:

My application code also has:

1. Docker file

2. Docker Compose file

3. 2 YAML files needed for Kubernetes:

    deployment.yml - It  is a YAML for kind deployment and service, for .net application

    mssql-deployment.yml - It  is a YAML for kind deployment and service, for sql server

Creating Azure DevOps project

Create a new project as below:

Go to the project and click on the Repos.

I have added my code in Azure DevOps Repos as below:

Creating service connections:

Create service connections for docker, Kubernetes, and Azure to communicate with DevOps as below:

Creating an Azure DevOps Pipeline:

Go to the project and click on the Pipelines, create a new pipeline "Deploy .net microservice in Kubernetes", follow the screen choices create a starter pipeline.

Replace the existing code with the code located in the file here:

The above YAML pipeline tasks are explained with comments in the file.

Once done, save and run the pipeline, you will see as below:

Once the pipeline runs successfully, Go to Azure Portal and select the Azure Container Registry. You will see the image is pushed to the container registry:

And also services are deployed to the Kubernetes cluster.

Now let's connect to the cluster. 

Using Azure CLI, run the following commands:

To connect: 
az login

To set the current context in Kube config:
az aks get-credentials --name eks_dev --resource-group kubernetes_dev

To see services running:
kubectl get svc

Use the external IP address to test your service in Postman:

Happy reading!


  1. I really like the way it is explained in such simple terms.. Superb. Thanks.

  2. This information is really awesome thanks for sharing most valuable information.
    Workday Training
    Workday Online Training

  3. Thank you for sharing such a useful article. I had a great time. This article was fantastic to read. Continue to publish more articles on

    Data Engineering Services 

    Data Analytics Solutions

    Data Modernization Solutions

    AI & ML Service Provider

  4. For example, people who participate in on line casino gambling (which contains digital gambling machines and desk games) extra likely to|usually tend to} experience problematic gambling behavior in comparison with} people taking part in} massive jackpot lottery video games . Demonstrating the discriminative differences between gambling formats and gambling behavior has essential policy implications as new forms of gambling are legalized and their availability expands. Recently, nevertheless, research has presented conflicting proof as to whether and how a lot the type of|the kind of} gambling format matters in relation to the chance of growing a gambling downside. Indeed, while many argue that 카지노사이트 some gambling formats are extra dangerous , others suggest that a extra critical factor is involvement (i.e., number of gambling formats by which an individual engages) . Gambling is changing into more and more widespread and accessible, typically promoted and enabled by governments.