What is Kubernetes?
In simple words, Kubernetes is a container orchestration tool that is used to maintain and deploy applications in the form of microservices.
k8s is a short form for Kubernetes, which means there are 8 characters between k and s
What are the benefits of using k8s?
Orchestration(keeps a check on the container's health and status)
Auto-scaling(Automatically scales the no of pods as per the requirement)
Auto-healing(Automatically deploys new pods in case of any failure)
Resource allocation(Allocates the resources according to the capacity of each pod)
Platform independence(Cloud, Virtual, Physical)
The architecture of Kubernetes:
Kubernetes works on master and slave architecture.
Master node:
It includes the following services:
Controller manager: Continuously monitors various components of the cluster and works towards managing /restoring to the desired state. Controller Manager is such an important part of Kubernetes that it has many other components working under it.
Node controller: Communicates with node server and manages nodes(if there is no heartbeat from any node for every 5 seconds, it waits for 40 seconds and if there is still no heartbeat then the node is replaced )
Replication manager: Responsible for monitoring the replica set. It ensures that desired no of pods is available at the required time
Cronjob: To schedule tasks to perform at a particular time at the desired frequency
Persistent Volumes: To persist data
API server: Application Programmable Interface generally refers to the interface through which clients can send requests to the server and get responses.
The API server in Kubernetes is the central control point that exposes the Kubernetes API, enabling users and components to interact with the cluster, manage resources, and make changes to the desired state of the system.
etcd: database which has all the information of all the nodes, pods, configs, secrets, accounts, roles, bondings etc stored as a key:value pair.
Scheduler: Responsible for scheduling the pods on nodes, it decides which pod to be placed on which node based on CPU, RAM and other resources of node
kubectl: kubectl is a command-line tool used in Kubernetes to interact with the cluster's API server. It allows users to create, manage, and monitor Kubernetes resources, such as pods, deployments, services, and more.
Worker node
It includes the following services:
Kubelete: Registers the nodes with pods, monitors the pods and reports to the kube api-server
Service/Kube-proxy: Pod network to communicate with each other using Pod IP. Kube proxy runs on each node using IP tables so that any service can connect to pod from outside
CNI network:
In Kubernetes, Container Network Interface (CNI) is a standardized specification for networking plugins, enabling communication between pods and external networks. CNI plugins handle tasks like creating and configuring network interfaces, setting up IP addresses, and applying network policies.
What is Control Plane?
The control plane in Kubernetes is a set of components (kube-apiserver, kube-controller-manager, kube-scheduler, and etcd) responsible for managing the cluster's state and coordinating tasks like deployment, scaling, and monitoring of containerized applications. It serves as the cluster's "brain," making decisions based on the desired state and responding to changes to ensure the system operates as expected.
Difference between kubectl and kubelets.
kubectl is a command-line tool for managing Kubernetes clusters and resources, while kubelet runs on each node and manages containers, ensuring they are running and healthy.