Kubernetes or K8s is an open-source platform that is widely used for container orchestration. It is designed to automate the deployment, scaling, and management of containerized applications. Kubernetes provides a rich set of features that help manage the complexity of deploying and managing containerized applications at scale. It can be used to manage and run applications in a variety of environments, including public, private, and hybrid clouds.
why K8s?
i) A software tool to run the dockerized application in the cluster of Nodes.
ii) Used to monitor/efficiently manage the environment of the enterprise application
iii) Stability of application.
K8s manages the containerized applications (DOCKER), (managing, deploying, scaling, load balancing)
FEATURES OF K8s:
Automates various manual processes: for instance, Kubernetes will control for you which server will host the container, how it will be launched etc.
Interacts with several groups of containers: Kubernetes can manage more clusters at the same time
Provides additional services: as well as the management of containers, Kubernetes offers security, networking and storage services
Self-monitoring: Kubernetes checks constantly the health of nodes and containers
Horizontal scaling: Kubernetes allows you to scale resources not only vertically but also horizontally, easily and quickly
Storage orchestration: Kubernetes mounts and add a storage system of your choice to run apps
Automates rollouts and rollbacks: if after a change to your application, something goes wrong, Kubernetes will rollback for you
Container balancing: Kubernetes always knows where to place containers, by calculating the “best location” for them
Run everywhere: Kubernetes is an open-source tool and gives you the freedom to take advantage of on-premises, hybrid, or public cloud infrastructure, letting you move workloads to anywhere you want
AUTOMATIC BIN PACKING:
k8s automatically packages the application and schedules the container based on requirements( CPC and RAM), while not sacrificing availability and saving resources available.
K8s Architecture:
The Kubernetes architecture consists of two main components: Master Node Components and Worker Node Components.
Master Node Components:
Master components are the control plane components of Kubernetes that manage the Kubernetes cluster. The master components include:
Kubernetes API Server:
The Kubernetes API Server is responsible for exposing the Kubernetes API, which clients use to interact with the Kubernetes cluster. It serves as the primary management point for the cluster, handling the validation and processing of API requests.
etcd:
Etcd is a distributed key-value store utilized for storing the configuration data of the Kubernetes cluster. It serves as the storage system for the cluster's state, encompassing the state of all objects such as pods, services, deployments, and more. Additionally, it is designed for fast and efficient operations, enabling quick access and retrieval of the stored configuration data.
Kube-Scheduler:
The Kube-Scheduler plays a crucial role in the Kubernetes cluster by handling the scheduling of pods onto the available nodes. It leverages information regarding the nodes' available resources and the resource requirements of the pods to make informed decisions about the optimal node for scheduling. By analyzing these factors, the Kube-Scheduler ensures efficient utilization of resources and effective distribution of workloads across the cluster.
Kube-Controller Manager:
The Kube-Controller Manager is responsible for running controllers that are responsible for maintaining the desired state of the Kubernetes cluster. The controllers include the node controller, the replication controller, and the endpoint controller.
Worker Node Components:
Node components are the worker components of Kubernetes that run on each node in the Kubernetes cluster. The node components include:
Nodes:
Nodes are the worker machines that run the containers. They are managed by the Kubernetes master components.
Pods:
Pods are the smallest deployable units in the Kubernetes cluster. They contain one or more containers and are scheduled on nodes.
Container Runtime Engine:
The Container Runtime Engine is responsible for running the containers on the node. Kubernetes supports several container runtimes, including Docker, CRI-O, and containers.
kubelet:
Kubelet is one of the main components of Kubernetes responsible for managing individual nodes and their containers. It is essentially an agent that runs on each node in the Kubernetes cluster and communicates with the API server to ensure that the containers running on the node are healthy and running as expected.
The kubelet performs several functions, including:
Fetching container manifests from the Kubernetes API server.
Ensuring that the containers described in the manifest are running and healthy.
Reporting the status of the containers back to the API server.
Mounting and unmounting volumes as necessary.
Executing container health checks.
kube-proxy
The kube-proxy component is responsible for managing the network proxy between the Kubernetes services and the pods that are running on the worker nodes. The kube-proxy uses various networking modes to ensure that the communication between the pods and services is efficient and reliable
Container Networking
The container networking component in Kubernetes takes on the critical role of enabling communication between containers running on worker nodes, as well as facilitating connectivity with external networks. Kubernetes offers various plugins for container networking, with some popular options being Flannel, Calico, and Weave.
These plugins handle tasks such as IP address management, routing, and network isolation to establish seamless connectivity between containers. They ensure that containers within the cluster can communicate with one another efficiently and securely. Furthermore, the container networking component enables containers to access external networks, allowing interaction with resources outside the Kubernetes cluster.