Day 30: Introduction to Kubernetes

Day 30: Introduction to Kubernetes

In my previous blogs, we learned about Docker, discussing what Docker is and why we need Docker in place of Virtual machines.

As we know Docker is a company that provides containerization technology that places applications with their dependencies, versions, etc that runs on any operating system. But docker doesn't provide scalability, flexibility, or automatic rollback roll updates. Every time we had to create containers manually this is where Kubernetes comes in.

What is Kubernetes?

Kubernetes is the brainchild of Google. We cannot say Kubernetes is replacing Docker, docker will always be supreme without docker we can't run Kubernetes. It was donated to CNCF i.e Cloud Native Computing Foundation in 2014.

Kubernetes has the feature of auto-scaling, automatic rollback, and roll updates, and most importantly it is open-source. Suppose any downtime occurs in an application or on the system it will automatically create another container or pods and that's the beauty of Kubernetes. It is also called K8s because it has eight letters between the letter K and S.

The architecture of K8s:

K8s architecture contains two components i.e Master and Node. Let's discuss these two components in more detail:

  • MASTER Component:

    In the Master there are 4 components:

1) kube-api-server:

The API server is the front-end control plane that manages or you can say decide whether the container is gonna be created or not.

2) Cluster Storage:

It is also known as etcd. It is the persistent storage that will store the information in the {Key: Value} pair and based on this kube-api-server will take the decision.

3) Controllers:

They are monitoring the cluster, it basically watches the changes that happen in the cluster, and also each and every has a separate controller. It also helps maintain the desired state(which means if any downtime occurs, it automatically creates the containers.)

4) kube-scheduler:

If the API server has taken any decision then the scheduler picks the decision and assigns it to the nodes.

  • NODE Component

    In the Node there are 3 components:

1) kubelet:

kubelet is a dummy agent, what API server will tell the kubelet it will exactly do. It watches the API server, and with that, it instantiates the pods and reports back to the master server. kubelet is an agent that is used for creating containers.

2) Container Engine:

In Kubernetes, we as DevOps engineers will be writing a manifest file that will create multiple containers in the pods. With the help of containers, images will be pulled down to the pods. The beauty of Kubernetes is if any downtime occurs you can anytime switch to the other container engine[Docker, rkt(rocket container technology), etc].

3) kube-proxy:

kube-proxy is Kubernetes networking. It gives the pod IP address, as in a single container we can create multiple pods so all the pods of a single container have a single IP address.

So, by writing the manifest file it will be uploaded to the API server then the changes that happen in the nodes will be watched by the controller, and with the help of cluster storage API server will make the decision and the scheduler will pick the decision and assigns it to the nodes.

What is Pod?

Pod is a minimal unit in Kubernetes. In a pod, we can have one or more than one container. Without pods, we can't be able to create K8s. By writing a manifest file pods automatically gonna created and under the pods containers of the images will be running. We can create multiple containers in pods with tight coupling but this is not the best to do because if any of the one containers inside the pods will face any errors then it will be reflected in another container. So by this, it is always recommended to make the single container in a single pod with loose coupling.

What is Control Plane?

Control Plane manages the worker nodes and pods so that they can communicate easily. If I would say control plane in simple words control plane is the master node that maintains the desired state.

Difference between kubectl and kubelet:

kubectl is the command line interface (CLI) tool that executes Kubernetes commands while kubelet is a dummy agent that watches the API server and instantiates the pods to the worker nodes.

So, that's it for today's Day 30 task of the #90DaysofDevOps challenge. In the next blog, we"ll be executing kubectl commands and creating the pods, and also discussing K8s topics in more detail.

STAY TUNED FOR THE NEXT BLOG !!

Follow for more upcoming Linux and DevOps tools blogs !!

You can connect with me on Twitter (amitmau07).

THANK YOU :)