DEV Community

Shatakshi Gupta
Shatakshi Gupta

Posted on • Updated on

Kubernetes components made easy! - Part 1

Kubernetes is an open-source container-orchestration system for automating computer application deployment, scaling, and management. This blog will help you know better about the main components of a Kubernetes Cluster.
Starting from the very basic unit of a Kubernetes Cluster:

Pod:

  • smallest unit of a Kubernetes cluster
  • usually preferred to contain only a single container Alt Text

Node:

  • unit greater than pod
  • consists of group of pods

Cluster:

  • Collection of Nodes

IP addresses:
Let us suppose you have an application that connects to a Database. Now Both of these components your application and Database are pods. Both these pods make use of IP addresses to connect to each other for managing the application.
Alt Text
Now what if the IP address of one of the pods changes due to some reason like the container in the Pod could not get enough space allocation for it to work or simply any problem occurred and now the container is destroyed and along with it, it's IP address also gets lost which is used by your application to connect to the DB(Database).
Now you create a new container and hence you need a new IP address and you now have to again change the configuration for managing IP addresses and much more.

This costs a lot of time and effort due to this problem the concept of Services was introduced which replaces IP addresses or we can say it provides a permanent IP address which won't change even if your container gets destroyed.
Alt Text

Your application is now working fine and you want to access your application on your system and for this you need to get it on local host and the service would provide the IP address somewhat like:
https://124.89.101.2:8080 which u don't prefer to see in place of:
https://my-app.com
Here comes the role of Ingress which basically converts your not so good looking IP address to some preferred IP address which then forwards this IP address to services which is then used for communication between different dependent pods.
Alt Text

Now suppose your dependent pod URL that is the service URL which is used to interact with other pods changes or you change it due to any good reason then you will need to change it in all files, configuration files and many more to avoid any difficulties in the future. But this can be really tedious task to do, so this task is done by Config-Map which basically stores the URL of services that are used and are dependent and in this you can simply change the URL anytime without any stress of modifying all the files.
Alt Text
Alt Text

Now there can be some confidential data as well that you don't want others to see, that data is stored in Secrets like user_id, user_password and much more confidential data.
Alt Text

Deployments
Deployment for creating replicas is usually called a blueprint of pods and in actual we deal with deployments only and not actual pods. We connect multiple deployments through services which acts as a load balancer & when one pod/deployment/replica dies it(service) forwards the request of the user to another blueprint/deployment.
Alt Text

Now we can not create deployments for databases & that is because every Database has some state and and if we create deployments of Databases then we need to keep track of every pod like which pod is currently reading data from data storage and which one is writing data to that storage and all this mechanism needs to be synchronized, maintained among every replica to avoid data inconsistency which is not an easy task so here StatefulSets are used.

StatefulSets is used for creating replicas, working or
managing applications like Databases to avoid data inconsistency.
Alt Text

Referred resources:

If you have come this far then I really appreciate your efforts and I hope you got a little idea about the main components of a Kubernetes cluster. Thanks for reading and have a great day! :)

Top comments (0)