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:
4 GB RAM
2 Cores of CPU
* Slave / Node:
2 GB RAM
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 192.168.7.40 is the ip address of the master server, 10.244.0.0/16 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 http://192.168.7.40:30001/ (192.168.7.40 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 :
https://www.edureka.co/blog/install-kubernetes-on-ubuntu
https://www.gremlin.com/community/tutorials/how-to-create-a-kubernetes-cluster-on-ubuntu-16-04-with-kubeadm-and-weave-net/

Share the news now

Source : Viblo