Kubernetes is an open-source container management tool which serves following purposes:
- container deployment
- container scalling and descaling
- container load-balancing
How does Kubernetes work?
Kubernetes consists of one or more Master Nodes. One master node can manage different worker nodes. Worker nodes are nothing but a virtual machine or server in the cloud.
For simplicity let's consider one master node that manages four worker nodes shown below:
These different worker nodes form a cluster which is managed by master. A worker node can contain one or more pods. Pods are also vm inside a worker node. Pods contains one or more docker containers.
What is Master Node?
Master node is responsible for managing entire cluster. A master node consists of four major components:
- Schedular
- Api Server
- Control Manager
- etcd
In order to issue commands to master node we use a cli tool called kubectl. This tool instructs master node regarding what to do with pods, services, workers etc.
Api Server all commands issued by kubectl has to go through Api server. If you want to create, delete or update pods api server take those instructions from kubectl.
Schedular is responsible for scheduling pods across different worker nodes depending on configurations.
Control Manager contains different types of controllers that helps in health checking of different nodes. To make sure correct number of nodes or pods are running all the time.
Etcd is a key/value database that stores states of the cluster, node or pods.
What is Worker Node?
Worker node is a physical server or vm where pods are deployed. A worker node has two basic components:
- Kubelet
- Kube-Proxy
Kubelet is responsible for health checking of pods or a worker node. If anything wrong with the node or pod it sends this information back to master node.
Kube-proxy is a core networking component that manage network across different pods. It also exposes services to outside world.
What is Pod?
Pod is a scheduling unit that manage different docker containers. A pod consists of single or more container in most cases single container.
Primary goal of pod is to deploy multiple dependent containers together.
What is container?
Container provide isolated runtime environment for applications. For example, if you want to run a nodejs application on your computer rather then installing nodejs on your computer you can create a container that has nodejs environment.
If you want to work on different application based on different nodejs version you do not need to install and re-install nodejs on your computer rather you can create different containers with different nodejs versions.
You can easily create and destroy this containers. To learn more about docker containers click below: