DR. ATABAK KH
Cloud Platform Modernization Architect specializing in transforming legacy systems into reliable, observable, and cost-efficient Cloud platforms.
Certified: Google Professional Cloud Architect, AWS Solutions Architect, MapR Cluster Administrator
This document shares an experience on setting up Kubernetes and then configuring your .NET Core application into your cluster. It will also help automate your deployment using a Kubernetes cluster instead of Visual Studio publish tools.
This experiment case contains: a) private cloud for Kubernetes deployment, and b) automated deployment of your .NET Core services through a basic CI/CD pipeline based on Jenkins.
Requirement
Quick Outline
Dotnet Core service on Linux
Installing dotnet core on Ubuntu 16.04 :
We can now copy our application into directory and then run dotnet run inside directory.
Then open browser and hit localhost. (if you specified any port for your project, you have to add port after localhost: https://localhost:6600)
Dockerize application
Since you are able to run your application via command, now it is time to dockerize it and create container for application and its dependent services. If you do not have docker installed, please follow the steps:
You might create a dockerhub repository and push your dotnet docker image over there for easy pull and run. Therefore, go to https://hub.docker.com and create an account. After logging in to Docker Hub click on the “Create Repository” button and create a new public repository. That is where we will be pushing our docker images.
Now, try to run dotnet publish to make sure your project can be compile properly before moving to docker container.
Now, we tring to package everything under bin/Release/netcoreapp2.0/publish/.
We create a Dockerfile on the root of our project with the following contents:
Building the container and testing that it works:
This is a personal blog. The views, thoughts, and opinions expressed here are my own and do not represent, reflect, or constitute the views, policies, or positions of any employer, university, client, or organization I am associated with or have been associated with.