Kubernetes Architechture
Tags: kubernetes, beginners, architecture
Published: 2020-07-14 13:59:12

---
series: 'Kubernetes in Private Cloud'
---

Before we enter into the practicals, we will finish the theory first (i.e.) understanding the terms and components involved.

Let us start with the nodes. 
![Node](https://dev-to-uploads.s3.amazonaws.com/i/ii4gpicothoq20jguy6v.jpg)
A node is a machine, physical or virtual, on which the Kubernetes is installed. A node is a worker machine and this is where the containers will be launched by Kubernetes. It is also known as minions.

Now, what if the node machine on which the application is running goes down. 
![node error](https://dev-to-uploads.s3.amazonaws.com/i/tbj9kd7j7uu4avk4g3gu.jpg)

Obviously, our application goes down and we don't want that to happen. That is why we have clusters.

![Cluster](https://dev-to-uploads.s3.amazonaws.com/i/fzhvisy81e4qvx0a0126.jpg)

A cluster is a set of nodes grouped together. Hence, even if one node fails, you have your application still accessible from other nodes. Also, having multiple nodes helps in sharing the load.

We have nodes and clusters, but,
<ul>
<li>who will be the orchestrator to manage these clusters and nodes?
<li> Where is the information about the members of the clusters stored? 
<li> How are the nodes monitored?
<li> When a node fails, how do you move the workload of the failed node to another worker node?
</ul>

This is where the master or the orchestrator comes into the picture. The master is another node with Kubernetes installed in it, and is configured as Master. 
![master](https://dev-to-uploads.s3.amazonaws.com/i/h0zqt2mg6icr3sh3kfkw.jpg)
The master watches over the nodes in the cluster and is responsible for the actual orchestration of containers on the worker nodes.

When Kubernetes is installed in a system, the following components are installed along with Kubernetes.

![Kubernetes components](https://dev-to-uploads.s3.amazonaws.com/i/s04i3ac7cegeeazionm5.jpg)

<ul>
<li><b>API Server:</b> The API server acts as the front-end for Kubernetes. The CLI, users, management devices all talk to the API server to interact with the Kubernetes cluster.
<li><b>ETCD Key store:</b> ETCD is a distributed reliable key-value store used by Kubernetes to store all data required to manage the key-value store. <i>When you have multiple nodes and multiple masters in your cluster, ETCD stores all the information on all nodes in the cluster in a distributed manner(sync). ETCD is responsible for implementing locks within the cluster to ensure that there are no conflicts between the masters </i>.
<li><b>Scheduler:</b> It is responsible for distributing work or containers across multiple nodes. It looks for newly created containers and assign them to nodes.
<li><b>Controllers:</b> They are the brains behind an orchestration and are responsible for identifying and responding when nodes, containers, or endpoints(Services) goes down. The controllers make the decisions to bring up new containers in such cases.
<li><b>Container Runtime:</b> It is the underlying software used to run the containers. We use docker for container runtime.
<li><b>Kubelet:</b> Kubelet is the agent that runs on each node in the cluster. The agent is responsible for making sure that the containers are running on the nodes as expected.
</ul>

Now we saw the different components involved in kubernetes. But what makes one a master and others a node.
![master_Node](https://dev-to-uploads.s3.amazonaws.com/i/1n84tgdnttktomu6chw5.jpg)
Master is the node, which has the kube-api server and that's what makes it a master. It also has the ETCD, controller and scheduler components.
Worker node or simply node is the one which has the container runtime and the Kubelet.