"Demystifying Kubernetes: A Comprehensive Guide to Container Orchestration and Beyond"
In this blog, we are going to understand the Kubernetes easily. Kubernetes has evolved as one of the best container orchestration platforms. So with no delay let's understand Kubernetes.
What is Kubernetes?
Kubernetes is a super-smart manager for our containerized applications. n simpler terms, Kubernetes is the behind-the-scenes hero that helps your applications stay organized and reliable. It is often abbreviated as K8s (because there are 8 letters between 'K' and 's' in "Kubernetes").
Problems with docker, Why K8S over docker?
While Docker provides the capability to create and manage containers, it may lack certain features needed for large-scale production deployments, such as efficient scaling, automated load balancing, and seamless management of containerized applications across a cluster of machines.
Single host Nature: While Docker indeed operates on a single host by default, Docker Swarm is Docker's built-in orchestration tool that allows you to manage a cluster of Docker hosts. This causes failure in containers. For example, if x,y, and z are the containers and x uses most of the resources while z is looking for the resources because of that, z container may die.
solution:
By default, K8S is a cluster. A cluster is a group of nodes. K8s is installed in the master node architecture. If any container is being affected (not getting resources, down, or unhealthy) Kubernetes will immediately put that container in a different node.
Auto Scaling: Docker does not have the feature of auto-scaling. If there is a sudden increase in the traffic in a certain container, then the docker cannot auto-scale the container.
solution:
Kubernetes has features like Horizontal Pod Autoscaling(HPA). Kubernetes has a replication controller i.e. Replica Set which always keeps on scaling the containers immediately if any container is down or killed.
Auto healing: If any container is unhealthy or down, the docker cannot auto-heal the container. Docker needs to create a new container.
solution:
Kubernetes controls and fixes the damages. It mostly controls the damages. When any container goes down K8s starts the new container as soon as the API server receives the signal pod is going down, it immediately rolls out the new container.
Docker does not provide enterprise-level support. Though Docker does offer Docker Enterprise, a commercial platform that includes enterprise-level support but only for small-scale organizations. While Kubernetes is suitable for large-scale organizations and provides a wide range of enterprise-level support like a load balancer. It is backed by the open source CNCF organizations and has third-party support.
Architecture of Kubernetes
The Kubernetes architecture consists of two planes. They are:
Control Plane (known as Master node)
Data Plane (known as worker node)
Let's understand each term from the K8s architecture.
The data plane or worker node consists of kubelete, Kube-Proxy, and container runtime.
Kubelet: It is responsible for maintaining the Kubernetes pods. It ensures that the pod is running and makes sure that the containers within the pod are in the desired state. It takes care of the communication between the Kubernetes Master and the nodes to manage the state of the pods.
Kube-Proxy: It provides the network rules. It generates the IP tables. It assigns the Ip addresses to the pods and provides default load balancing.
Container runtime: A container runtime is indeed the software responsible for running containers, including the pods in Kubernetes
The control plane or master node consists of an API server, kube-scheduler, etcd, controller manager, and cloud control manager.
API server: The Kubernetes API server is like the control center of the entire Kubernetes cluster. It exposes the Kubernetes API, which is used by both the Kubernetes control plane components and the command-line tool, kubectl, to communicate and manage the cluster. It serves as the front end for the Kubernetes control plane.
Kube-scheduler: The kube-scheduler is indeed responsible for scheduling pods onto nodes in a Kubernetes cluster based on the resource requirements and constraints specified in the pod specifications. It acts on information received from the API server.
etcd: etcd acts as a backing store of entire cluster information. It serves as the distributed key-value store that holds the entire configuration and state information of the Kubernetes cluster. The cluster information, represented as object or key-value pairs, is stored securely in etcd.
controller manager: It ensures that the different controllers in the K8s are running that are responsible for maintaining the desired state of different objects in the cluster. For example: ReplicaSet controller, servicer controller, deployment controller, job controller, etc.
cloud control manager(ccm): It is an open-source utility that supports Kubernetes in different cloud providers but is not required for on-premise deployments.It is indeed a component that interacts with cloud provider APIs to manage resources in a cloud-specific way.
Tips:
Kubectl: It is a command line tool to interact with Kubernetes clusters.
Happy Learning!!