What is Kubernetes? And its Components



Kubernetes is an open-source container management tool used to manage containers. It eases the deployments, scaling, automation, and management of the containers. It is developed by Google and now it is maintained by CNFC (Cloud Native Computing Foundation).

POD: Pod is the smallest unit of Kubernetes. Containers are encapsulated into a Kubernetes object known as POD.

Why Kubernetes?

Allocation of resources according to the requirement is the ideal state. If the resource is less than the requirement our application can crash or if the resources are more than the requirement, then waste of resources and money. So we need a tool to manage these things for us, and Kubernetes does this for us.

Here are some key features of Kubernetes:

1. Load Balancing
2. Self-healing
3. Managing desired state
4. Secrets management

Load Balancing: This is the key feature of the Kubernetes, It automatically creates or destroys pods as per the workload. It creates the container from the template provided at the time of creation YAML file.

Self-healing: If any pod stops working then it automatically detects, destroys the pod, and creates a new one to make the desired state.

Managing desired state: Kubernetes also takes care of the minimum no of resources required to run any application. So it makes sure at least desired no of resources are allocated to the application.

Secrets management: Kubernetes also securely stores our sensitive data like passwords, OAuth tokens, keys, etc. with encryption in our cluster.



Components of Kubernetes:-

Kube-API: Kube-API is the main/primary management component of Kubernetes. Kube-API is responsible for authenticating and validating the request, retrieving and updating the values in the data store. Kube-API is the only component that interact with ETCD directly.

Etcd: It is a key value store that store value in key value format. It is fast and secure and simple to work. In Kubernetes ETCD stores information regarding cluster such as nodes, pods, configs, secrets, and other. Every single change we made in the Kubernetes cluster stores in the ETCD data store. If the change is not stored in the ETCD data store then it is not address by the cluster. ETCD works on port no. 2379.

Scheduler: Kube scheduler is a process that decides which pod goes to which node. It decides by analysing the resource availability like amount of free RAM, CPU and other resources. It checks that how much spaces of resources left after placing the pod on the particular and decides whether it will place the pod on particular node or not.

Kube controller: Kube controller is the process that monitors the state of various components and makes sure the desired state.

Some controllers:
1. Node controller
2. Replication controller
3. Namespace controller
4. Cron Job controller
5. ReplicaSet controller
6. PV Protection controller
7. Deployment controller
8. Service account controller
9. Endpoint controller
10. Job controller etc

All controller are packaged in one service name kube controller manager.

Explaining one of the controller is Node controller:

Node controller: The node controller is responsible for monitoring the status of nodes and take the necessary actions to keep the application running. It does that through Kube-API Server.
How?
The Kube-API server checks the state of the nodes in every 5sec that way node controller can monitor the health of the nodes if it stops receiving a heartbeat from the node and a node is marked unreachable, then it gives the grace period of 40s to get reachable. After 40sec if the node is not reachable then it gives the node come back time of 5 mins more, then if it does not get reachable then it declares it unhealthy.

Kube Proxy: Kube proxy is the process that handles the networking or connectivity between the pods. Kube proxy maintains the networking protocols and allow networking communication within Kubernetes pods and processes or outside the world.

Kubelet: It is the captain of the ship. It is the point of contact between the master and worker node. It requests the runtime to create or destroy a pod or a container as instructed by the scheduler. It also monitors and sends the status report of the Pods and containers to Kube-API on the regular intervals.

Share Blog

Comments Section