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:
- smallest unit of a Kubernetes cluster
- usually preferred to contain only a single container
- unit greater than pod
- consists of group of pods
- Collection of Nodes
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.
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.
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://18.104.22.168:8080 which u don't prefer to see in place of:
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.
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.
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.
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.
- Docker & Kubernetes Tutorial series
- Kubernetes Official website
- Kubernetes GitHub
- Images referred from here
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! :)