Deploying .NET Application on Docker & Kubernetes

by Gursimran | June 02, 2017 |  Categories -  Microservices, Docker, Kubernetes

Blog Single Post Image




In this Post , We’ll share the Process how you can Develop and Deploy .NET Application using Docker and Kubernetes and Adopt DevOps in existing .NET Applications




To follow this guide you need


  • Kubernetes - Kubernetes is an open source platform that automates container operations and Minikube is best for testing Kubernetes.


  • Kubectl Kubectl is command line interface to manage Kubernetes cluster either remotely or locally. To configure kubectl in your machine follow this link.


  • Shared Persistent Storage - Shared Persistent Storage is permanent storage that we can attach to the Kubernetes container so that we don`t lose our data even container died. We will be using GlusterFS as a persistent data store for Kubernetes container applications.


  • .NET Application Source Code - Application Source Code is source code that we want to run inside a kubernetes container.


  • Dockerfile - Dockerfile contains a bunch of commands to build .NET application.


  • Container-Registry - The Container Registry is an online image store for container images.


Below mentioned options are few most popular registries.



Create a Dockerfile


The below-mentioned code is sample dockerfile for .NET applications. In which we are using Microsoft .NET 1.1 SDK for .NET Application.



Building .NET Application Image


The below-mentioned command will build your application container image.



Publishing Container Image


Now we publish our .NET application container images to any container registry like Docker Hub, AWS ECR, Google Container Registry, Private Docker Registry.


We are using Azure Container Registry for publishing Container Images.


You also need to Sign Up on Azure Cloud Platform and then create Container Registry using this link. 


Now Click The Link to Pull and Push to Azure Container Registry.


Similarly, we can Push or Pull any container image to any of the below-mentioned Container Registry like Docker Hub, AWS ECR, Private Docker Registry, Google Container Registry etc.


Creating Deployment Files for Kubernetes


Deploying application on kubernetes with ease using deployment and service files either in JSON or YAML format.


  • Deployment File


Following Content is for “<name of application>.deployment.yml” file of Python container application.



  • Service File


Following Content is for “<name of application>.service.yml” file of Python container application.



Running .NET Application on Kubernetes


.NET Application Container can be deployed either by kubernetes Dashboard or Kubectl (Command line).


I`m explaining command line that you can use in production Kubernetes cluster.



Now we have successfully deployed .NET Application on Kubernetes.




We can verify application deployment either by using Kubectl or Kubernetes Dashboard.


The below-mentioned command will show you running pods of your application with status running/terminated/stop/created.



Result of above command


Information of Kubernetes Pods



Get the External Node Port using the below-mentioned command. External Node Port are in the range from 30000 to 65000.



Launch web Browser and open any of the below-mentioned URLs.


  • http://<kubernetes master ip address >: <application service port number>

  • http://<cluster ip address >: <application port number>


Notes - For above specific .NET Application, you will get the Pods Output.


Kubernetes Application Pods Output




  • Check Status of Pods.

  • Check Logs of Pods/Containers.

  • Check Service Port Status.

  • Check requirements/dependencies of application.




At XenonStack we have specialized professionals that can help you in starting with Microservices Architecture, NoSQL and SQL Database, Docker & Kubernetes. Reach Us for Development, Deployment, and Consulting for MicroServices, Kubernetes, and Docker Technology Solutions.  


If You looking to Migrate or Adopt DevOps in your Existing .NET Application, We will help you migrate to DevOps and Cloud Computing. Also we can help you to leverage the New .NET framework Core and MS SQL for Linux to adopt Microservices Architecture using Docker and Kubernetes.


XenonStack Offerings


XenonStack is a leading Software Company in Product Development and Solution Provider for DevOps, Big Data Integration, Real Time Analytics & Data Science.


Product NexaStack - Unified DevOps Platform Provides monitoring of Kubernetes, Docker, OpenStack infrastructure, Big Data Infrastructure and uses advanced machine learning techniques for Log Mining and Log Analytics.


Product ElixirData - Modern Data Integration Platform Enables enterprises and Different agencies for Log Analytics and Log Mining. 


Product Akira.AI is an Automated & Knowledge Drive Artificial Intelligence Platform that enables you to automate the Infrastructure to train and deploy Deep Learning Models on Public Cloud as well as On-Premises. 


Get 1 Hour Free Assessment for DevOps, Big Data Strategy, and Data Science. CONTACT US NOW