Breaking down into K8s!

It was 2019 when I first attended the PyCon India conference and heard the term kubernetes. I had no idea back then what it was, it’s use, it’s requirement. Last year, 2020 I heard about docker and kubernetes and they do something with containers and all, still no idea what is the difference between two. But this time I got into it and finally breaking down kubernetes into simple concepts for you all to read.

Before jumping into k8s, let us know the basic concept; containers. For people who required to use more than one technology such as web server (node JS), database (mongo DB), messaging system (Redis) and an orchestration tool( Ansible) all together had to face a lot issues to develop. Firstly their compatibility and version of OS they planned to use. Different components required different OS for these tools to work. Secondly, they had to check their compatibility between the services and the libraries and dependencies on the OS. Issues like one service required one version of the dependent library whereas another service required another version. For new developers it was a hectic job to set-up a project because the services required might not be compatible with their system or OS.

Here containers came into rescue. Containers are nothing but an isolated environment just like Virtual Machines but unlike VMs they do not have their own separate OS. Now they just had to build a container using a docker run command and they can create separate environments according to the need of the services. Containers have their own processes and their own networking interfaces, their own mounts. The concept of containers had been existed for about 10 years and some different types of containers are like LXC, LXD, LXFC etc. But here is the catch, docker uses the same OS kernel hardware. The kernel must remain same but the softwares used can be different, for an example you can have softwares like Ubuntu, OpenSUSE, Fedora. These softwares might have different user interfaces, drivers, compilers, file managers, tools etc but their OS kernel should be common for using docker. So you can run a Linux based container in linux based OS but not on a windows based kernel. The main purpose of docker is to containerize applications and ship them.

Now it is time to work among these containers and organize them according to the need, this is where k8s is used. Kubernetes is a platform which orchestrates connectivity between containers. The advantage was that your app will work without any hardware failure because you can deploy more instances if one container failed. You can scale up if the demand increases and scale down if the workload increases. What we do in the containers is that we install the required package or image which we need and containerize them according to their favorable environments. An image is a template or package used to create containers. Containers are running instances of images that have their own environments and set of processes. K8s architecture is simple to understand. K8s uses nodes; nodes are a physical or virtual machine where k8s is installed. The containers will be launched here. A set of nodes is termed as cluster. In this cluster there is a master node and worker nodes. Master node is responsible for the orchestration of worker nodes and watches over the worker nodes.

K8s components consist of:

  • API server – interacts with kubernetes cluster
  • etcd – is a distributed reliable key-value store all data used to manage the cluster.
  • scheduler – is responsible for distributing work or containers across multiple nodes. Looks for newly created containers and assigns them to nodes.
  • Controller – Responsible for when containers, nodes or end point ends. they are responsible to make decisions to bring up new containers in these cases.
  • Container runtime – Underlying software to run container.
  • Kubelet – works as an agent for making sure the nodes are running without any trouble

If you want to read more about Kubernetes components click here

1 Comment

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s