Kubernetes: The undying army of Cloud Kingdom- Part 4

Note : This is Part 4 of Kubernetes: The undying army of Cloud Kingdom

Commanders and Wizards

“I need to take this call, its from work”- I grabbed my ringing phone. When I returned she was not very happy.

“You always do this” — She is so upset now 😡

Darling, it was from work, you know what? some bad forces tried to take down our pods today. 👹

“And ?”

With the help of our cluster we were able to fight it back, but it took down some of our pods down. They were re-spawned and the application survived😅

“Who are these bad forces trying to take your applications down ? “ — She is curious.😱

Well, there are many bad forces, I’ll tell you about them. But don’t you want to hear about the commanders and the wizards who saves the day ?

Commanders of the Node

Remember the Container Runtime ? He is an elite member of the Node commanders. The leader of the commanders in the Node is the Kubelet. When it needs to control a container, Kubelet talks to the container runtime to make it happen. Also its the Kubelet that allocates resources to the Pods, like allocating food, water and supplies to the fighting soldiers. Also there needs a medium through which these commanders and the other components can communicate. That is KubeProxy, the third commander in the Node.

Each node is like a platoon where several Pods fight for our application, and the platoon needs to be commanded. The three commanders in the Nodes should get instructions to lead the platoon.

“So who is in charge of the platoons ?”🤔

Its the wizards of the Master Nodes

Wizards of the Master Nodes

There are four wizards in every master nodes that makes this magical army work. When we , software engineers want to talk with the cluster we talk to one of the wizards in the … ! — She stopped me 🤚🏽

“You can talk to the clusters ? “

aah, well its using the ….

“oh.. spells” — she completed the sentence.

Yes. So when we want to talk to the clusters, we talk to one of the Wizards, his name is API Server.

“what do you tell this wizard” ?

Aah, “like start up a new Pod!”. When we do that spell, API Server hears it and tells another wizard to do it. Another wizard who is responsible for scheduling the pods to start and stop on a node. That is Scheduler

Scheduler knows exactly in which node to start a pod, she is so intelligent that she identifies the platoon where the new frontline soldier is to be deployed.

Once she identifies to Node to which the pod is to be deployed, she gets in touch with the Kubelet of that Node, and whispers her command to the Kubelet, and according to the command of the Scheduler, Kubelet talks to the container runtime to start the Pod and container inside it.

“Okay.. what happens when a Pod dies”

There is a third wizard in the master node, his name is Controller Manager. Whenever controller manager knows that there is a Pod down, he asks the Scheduler to deploy a new Pod, so that we always have the Pods running to keep the application alive.

“How does they know that a pod is dead”

Well, there is a master wizard, the wisest of them all, she is the all-knowing Etcd.

Etcd knows what happens in the whole cluster, she knows the state of each and every Node in the whole cluster. Her crystal ball, which is a key-value store has the state of everything happening in the cluster. All the other wizards in the master node talks to Etcd, when it comes to knowledge about the components of the cluster.

“The phone is ringing again” 👹

Looks like the bad forces are trying to take our application now. 👻

Do you want to see how our cluster fights back ? 👺

Part 5 — The battle in the Cloud