Day 30: Kubernetes Architecture
What is Kubernetes (K8s) and Why "K8s"?
Kubernetes (K8s) is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. It simplifies the management of complex containerized applications across clusters of hosts. The name "Kubernetes" comes from the Greek word for "helmsman" or "pilot," reflecting its role in steering and managing containerized workloads.
Benefits of Using Kubernetes
Scalability: Kubernetes enables effortless scaling of applications by adding or removing containers based on demand.
Fault Tolerance: It ensures high availability and fault tolerance by automatically restarting containers that fail or become unresponsive.
Portability: Kubernetes provides a consistent environment across development, testing, and production, allowing seamless application deployment.
Resource Efficiency: It optimizes resource utilization by efficiently scheduling containers on underlying infrastructure.
Automation: Kubernetes automates various aspects of application management, reducing manual intervention and human errors.
Architecture of Kubernetes
Kubernetes follows a master-slave architecture, consisting of:
Master Node: Controls the Kubernetes cluster and manages its state.
Worker Nodes (Minions): Host the applications and containers managed by Kubernetes.
Control Plane
The Control Plane, also known as the Master Node, consists of several components:
API Server: Serves as the central management point and handles communication with Kubernetes objects via the Kubernetes API.
Scheduler: Assigns newly created pods to worker nodes based on resource availability and scheduling policies.
Controller Manager: Ensures that the cluster's current state matches the desired state, handling node failures, scaling, and other tasks.
etcd: Stores the cluster's configuration data and represents the cluster's single source of truth.
Difference Between kubectl and kubelet
kubectl: Command-line interface (CLI) tool used to interact with the Kubernetes cluster, allowing users to deploy and manage applications, view logs, and perform other administrative tasks.
kubelet: Agent that runs on each worker node and communicates with the Kubernetes API server. It manages the containers on the node and ensures that the containers described in the pod manifests are running as expected.
Role of the API Server
The API server acts as the frontend for the Kubernetes control plane, exposing the Kubernetes API and serving as the gateway for all administrative tasks. It validates and processes requests, updates the cluster state stored in etcd, and communicates with other components to execute user commands and manage cluster resources.