In this post, We’ll share the process of how you can Develop and Deploy .NET applications using Docker and Kubernetes and Adopt DevOps in existing .NET Applications.Continuous delivery is a branch of continuous integration. It concentrates on automating the software delivery process so that teams can quickly and confidently deploy their code to production at any point.
Kubernetes - Kubernetes is an open-source platform that automates container operations, and Minikube is best for testing Kubernetes.
Kubectl - Kubectl is a command-line interface to manage the 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 the source code that we want to run inside a kubernetes container.
Dockerfile - Dockerfile contains a bunch of commands to build a .NET application.
Container-Registry - The Container Registry is an online image store for container images.
Below mentioned options are the few most popular registries.
The below-mentioned code is a 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
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 Registryfor publishing Container Images.You also need to Sign Upon Azure Cloud Platformand then create a Container Registry using this link.Now Click The Linkto 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.
Deploying application on kubernetes with ease using deployment and service files either in JSON or YAML format.
Following Content is for the “<name of application>.deployment.yml” file of Python container application.
Following Content is for the “<name of application>.service.yml” file of Python container application.
How to run .NET Application on Kubernetes?
.NET Application Container can be deployed either by kubernetes Dashboard or Kubectl (Command line).I`m explaining the command line that you can use in the production Kubernetes cluster.Now we have successfully deployed .NET Application on Kubernetes.
Verification of Application deployment
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 the above command
Get the External Node Port using the below-mentioned command. External Node Port are in the range from 30000 to 65000.Launch a 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 the above specific .NET Application, you will get the Pods Output.
Troubleshooting the .NET Application
Check Status of Pods.
Check Logs of Pods/Containers.
Cross Check the Service Port Status.
Check the requirements/dependencies of the application.
With Xenonstack and Azure Kubernetes Services, deploy, scale and manage Docker containers and applications. Azure Kubernetes Solutions
At XenonStack, we have specialized professionals to help you start with Microservices Architecture, NoSQL and SQL Database, Docker & Kubernetes. Reach Usfor 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.