How to deploy the Kubernetes product environment to deploy microservice

Tram Ho

Hello everyone today I would like to quickly share with you the steps to create kubernetes cluster on Ubuntu 16.04 machine to deploy microservice

Requirements before installing Kubernetes

Since we are working with VMs, I suggest that you follow the settings for the virtual machine as follows:
* Master:
2 Cores of CPU
* Slave / Node:
1 Core of CPU

Step 1: install kubeadm, kubelet, kubectl, docker for master, node

You can read more here!

Step 2: Now we will launch the kubernetes cluster on the server (master)

Use root to run:

Here is the ip address of the master server, is the default network range

As mentioned above in the picture above, we will run the following commands as a normal user

To check if the kubenete cluster is working or not running the command:

As you can see the coredsn of the same search is still pending state, this is because we are missing a network for pods (pods network).

Step 3: Network setup for pods, here we will use flannel network

Create a kube directory, in which we create the file kube-flannel.yaml

Run network setup:

Maybe after the installation is complete you get an error in crashloopbackoff coredns as above. Follow below:

Run :

Coredns is up and running

Step 4: Add Node Machine to the cluster

Run the following command to get the join statement:

To join the node machine, run the following command on the Node Machine

Review :

As you can see above, we have the kube-proxy and flannel network on the node knote1 machine

Step 5 deploy test a service

  1. Clone microservice sock shop on git repo:

  1. Create namspace

  1. Run the demo

Visit ( is the master’s ip address) to check

So above, I have guided you step by step to build a kubenetes environment for deploy microservice. Because of focus on steps that ignore explanation of relevant knowledge. So if you have any questions, you can comment below!

Good luck !

References :

Share the news now

Source : Viblo