kubernetes 101 : A brief architecture overview.
Docker allows us to run single applications inside a container, but when we have thousand of containers running on different nodes, we would need a way to watch the load of the nodes, their health, the state of the containers and whether we need to re-deploy a failing container ...
That is the role of kubernetes.
Pod is the smallest unit in kubernetes. It is a layer that wraps around the container making it possible for it to run in kubernetes. Pods typically runs only one container but they can run more than one. They also have an IP address.
Below a diagram showing an overview of kubernetes:
We feed the API server the YAML configuration file though the command line or GUI.The file contains instructions about the creation of the pods on the worker nodes.
The master node components:
Controller manager : When Pods stop working, we need to reschedule them as soon as possible. The controller manager among other things detects the crashing Pods and orders the Scheduler (see below) to re-deploy the Pod.
Etcd server : It stores the cluster state information. When a Pod crashes or gets scheduled for deployment for example, the information is stored in the Etcd server. The Scheduler and the Controller manager rely on the Etcd information ta make their decisions. Etcd stores all that information in all the nodes of the cluster.
Scheduler : Starts a Pod on a worker node after deciding which node has enough resources and is more suitable for the application we want to deploy. It then instructs the Kubelet (on the worker node) to start the Pod (see below).
The worker node components:
Kubelet : Is an agent that runs on the worker node, it receives information from the Master node, the worker node and the Pod inside the worker node. It schedules and starts the pods on the worker host and assigns resources to it (memory, space,...)
Pod (explained above): It is a layer that wraps around the containers. We can use different container engines to start the containers that run inside the pods ( Docker, Mesos or LXC ).
Kubelet proxy: makes sure the containers on the nodes reach each other using different tools like port forwarding and masquerading with the help of the iptables.