Microservice deployment in Kubernetes by node wise

4/17/2018

I am trying to deploy my set of microservices in different nodes. For installing kubeadm and creation of clusters I am following the below documentations.

  1. https://medium.com/@SystemMining/setup-kubenetes-cluster-on-ubuntu-16-04-with-kubeadm-336f4061d929
  2. https://medium.com/@Grigorkh/install-kubernetes-on-ubuntu-1ac2ef522a36
  3. https://www.youtube.com/watch?v=b_fOIELGMDY&t=108s

I need one master with 2 worker machines. I got clear idea about how to create the kubernetes clusters.

My requirements: I have an application which has separate set of microservices. I need to deploy docker images for one set of microservices into one node1.And docker images for other set into node2. And 3 rd set of microservices in node3...etc...This is my planning of deployment. Please correct me if I am going in wrong direction, Since I only started exploration in docker, kubernetes and jenkins. Devop.

My confusions:

  1. According to my requirement region wise deployment by nodes , Is this deployment strategy is possible by Kubernetes ? And is this one of the standard way ?
  2. If I am using Jenkins for implementing CI/CD pipeline , then Do I need to install Jenkins in each Vm? Means master machine and also in machine which resides nodes?

These all are my confusion about this Kubernetes deployment. Please correct me if my thoughts are wrong, since I am only a beginner in DevOp world. How can I clarify my doubts about deployment by using Kubernetes ?

-- Jacob
jenkins
kubernetes

1 Answer

4/17/2018

To answer your first question - you basically need to allocate each node for a tenant. If there are compliance/regulatory reasons then you should do it (Though it won't be very efficient). Here is how you can do it:

On the node1 add a taint:

kubectl taint nodes node1.compute.companyname.com reservedfor=tenant1:NoSchedule

What above means is that the node1 will only schedule pods which have a matching toleration and not any other pod. For the microservice which you need to schedule on node1, you will have to add a toleration to the pod YAML file like:

tolerations:
- key: "reservedfor"
  operator: "Equal"
  value: "tenant1"
  effect: "NoSchedule"

The same logic can be extended - so that even if tenant1 needs 4 machines, then all the 4 machines can be tainted with above key value pair and then pods can be tolerated on those nodes. Check out the documentation here and blog with an example here

You can also use the pod/node affinity to achieve above.

Your second question on Jenkins - No, you don't need to install Jenkins on each node, but other than that more details are needed for that question.

-- Vishal Biyani
Source: StackOverflow