This content originally appeared on DEV Community and was authored by Shatakshi Gupta
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 k8s cluster
- usually preferred to contain only a single container
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.
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://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.
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.
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.
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.
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.
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! :)
This content originally appeared on DEV Community and was authored by Shatakshi Gupta
Shatakshi Gupta | Sciencx (2021-08-26T17:44:54+00:00) Kubernetes components made easy! – Part 1. Retrieved from https://www.scien.cx/2021/08/26/kubernetes-components-made-easy-part-1/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.