In this part we will look towards creating a .Net core basic web API. In part 2 we will look at how to containerize the application using docker. In part 3 we will set up a kubernetes cluster using Azure container service and connect to it using kubectl client.
In the final part we will be running our application inside the cluster.
Prerequisites
- Azure subscription
- A machine with Docker installed and a Docker registry to push our Docker image.
- A running kubernetes cluster in azure container service.
Brief introduction to .Net core
.NET Core is a general purpose development platform maintained by Microsoft and the .NET community on GitHub. It is cross-platform, supporting Windows, macOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.
For more information about .Net core please check the official Microsoft site.
- .NET Core
Check out the "Getting Started" tutorials to learn how to create a simple .NET Core application. It only takes a few…docs.microsoft.com
Let’s begin the hands on part by creating a basic .Net core API using command line tool:
Step 1 Download the .Net core SDK
You can download the SDK from here for the OS of your choice.
Step 2 Initialize the code
Open the command prompt and use the command line tool to initialize a web API application
dotnet new webapi –n demoservice
Folder structure in VS code
If we look at the demoservice directory, we will be able to find a Controllers directory, inside which there is a ValuesController.cs which is created by default. It’s pretty much the same as asp.net web API controller with Get, Post, Put and Delete methods.
Step 3 Restore the dependent packages




Join the conversation! Your thoughts help the community grow.