This blog post is the first of a new topic about Kubernetes.
Kubernetes is an open-source container-orchestration system for automating application deployment, scaling, and management. It was originally designed by Google, and is now maintained by the Cloud Native Computing Foundation.
This post introduces some basic concepts of Kubernetes with a working example based on .Net and Visual Studio. We’ll develop a simple Web API service, package it as a Docker container, upload it to Docker Hub, and we’ll run it onto Kubernetes.
Before we can move on with Kubernetes we need to upload this image to Docker Hub because Kubernetes will try to download from it the images for the containers that it will create. In order to do that we need an account (free for open projects) of Docker Hub.
The first thing we need to do is a docker login from the command line to handle the authentication to our repository.
Now we can push our image with:
docker push phenixita/ic6redsvc:latest
And it’s done!
We can deploy our app onto Kubernetes! I recommend to use a managed Kubernetes instance from your provider of choice (AWS, Azure, you name it) or run in your machine something like Minikube. Docker for Windows provides support for a single Kubernetes cluster with low hardware requirements.
This is a Kubernetes Cluster. It is composed by a master node and working nodes. The master node is the coordinator of all the activities that happens inside a cluster. The working nodes are the computer power (most of the time they are virtual machines) that will do the job of running our code.
Check that kubectl is configured to talk to your cluster, by running the kubectl version command.
To view the nodes in the cluster, run the kubectl get nodes command:
Here we see the available nodes (1 in our case). Kubernetes will choose where to deploy our application based on Node available resources. Let’s run our first app on Kubernetes with the kubectl run command.
The run command creates a new deployment. We need to provide the
deployment name and app image location (include the full repository url for
images hosted outside Docker hub). We want to run the app on a specific port so
we add the –port parameter:
kubectl run ic6redsvc --image phenixita/ic6redsvc:latest --port=80
We need to get the pod name with:
kubectl get pods
Our app is running in a private network and we need to activate a proxy in another terminal to be able to test it. This is not the standard approach for production environments, we'll see in future blog post how to do it properly. Now we try to keep things as simple as possible.
This is the final step where we call our API. We compose the command like the following example.
dotnet is the base command of the SDK and it has many features like testing, nuget functionalites, managing dependencies and otheres. The new command is used to initialize new applications and we specify a console application and we want that application in the HelloCore directory. cd HelloCore moves into the newly created app directory.
View the code
With our favourite text editor we open Program.cs and we see that dotnet new has created a simple hello world app.
static void Main(string args)
> dotnet run
command we launch our first .Net Core app.
> Hello World!
.NET Core is a brand new implementation of .NET and it’s the multi-platform component of the .NET family.
With this blog post we explored the basic concepts of .Net Core. We also created our first app in 5 minutes.
Disclaimer: non ho idea di cosa sto parlando, sono in una fase di brainstorming e potrei dire le più alte stupidaggini.
Quindi se io volessi sviluppare un’app partendo da foglio bianco nel 2017 restando nell’ecosistema degli strumenti Microsoft posso scegliere tra:
.NET Framework 4.6(.2): il famosissimo Framework standard e completissimo che tutti conosciamo per applicazioni e web sistema operativo Windows centriche;
.NET Core: evoluzione del .NET Framework (che non ho capito se si fermerà alla versione 4.6.2). Ridisegnato, open-source, per applicazioni server/console (?) multi-piatta (Windows, macOS, Linux) (ASP.NET Core). Non ci sono GUI multi-piattaforma (WPF, tipo).
Xamarin per applicazioni mobile multi-piattaforma.
UWP: Parte del .NET Core per sviluppare app che attraversano tutte le varianti del SO Windows 10 (da Enterprise a IoT, Mobile e Xbox One compresi).
Mettiamola graficamente (grazie blog Microsoft)
La cosa incredibile è che con Visual Studio e C# si possono attraversare tutte queste tecnologie. Fantastico.
Senza menzionare tencologie/integrazioni con motori grafici quali Unity (con cui fare giochi, applicazioni VR/AR) e potenza del cloud (Azure che è un mondo vastissimo solo quello).