Qui di seguito riporto il manifest YAML con il deployment con ConfigMap mostrato nel video. La configMap viene usata facendo il mount di un volume. Tale volume viene definito nella sezione spec del template e referenziato nella sezione container colla sintassi volumeMount.
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.