nsaphiladelphia.blogg.se

Kubernetes docker tutorial
Kubernetes docker tutorial












  1. #Kubernetes docker tutorial install
  2. #Kubernetes docker tutorial code

Step 2: Download minikube curl -Lo minikube \

#Kubernetes docker tutorial install

Step 1: Install Docker sudo apt install docker.iosudo groupadd docker & sudo usermod -aG docker $USER Refer to the Kubernetes site to know the instructions for other operating systems. These instructions assume Ubuntu Linux OS. This section covers the installation of minikube, local registry, building the image, and finally running the container on the local minikube. This section illustrates the running of the sample application on a minikube version of Kubernetes (K8s). Execution to see a detailed way to deploy and see it in action. However, to access the application you need to create a service and access the POD through the service. Once the POD is in running state, the node JS Application would be running at 3000. When you create a deployment with the above YAML, the Kubernetes downloads the images jcg-nodejs:1.0.0 and runs it as a container.

kubernetes docker tutorial

Here the above YAML, shows that the deployment name is deployment-jcg and it has a POD specification for a single container (name: jcg-nodejs) based on the image jcg-nodejs:1.0.0 and the image itself exposes a port 3000, The below listing is the YAML to create the deployment: Let us consider the image generated using the example application is jcg-nodejs:1.0.0.

#Kubernetes docker tutorial code

The application code also comes with deployment-jcg.yaml which can be used to deploy the image, generated using the above Dockerfile, on to the Kubernetes cluster. It comes with a Dockerfile using which you can generate a Docker image.

kubernetes docker tutorial

You can start the application by simply executing node app.js provided you have Node version 12 is installed. The node JS has a start point app.js which the endpoint “/” which returns a text – Welcome to the JCG tutorial for Kubernetes Docker Integration. The application consists of a simple Express-based nodeJS application. When the Kubernetes master issues a command to the worker nodes to create a POD, the worker node downloads the said docker image and runs the same as a container.

kubernetes docker tutorial

When a deployment is created the K8s create a POD based on a given Docker image. Here kubectl deploys an application through a deployment. Let us take an example of running a simple node JS application enabled by Express.














Kubernetes docker tutorial