Kubernetes 8-Week Learning Journey
Week 02: Understanding Kubernetes Architecture
Hello everyone,
Welcome to my Kubernetes blog series! Over the next eight weeks, I'll be diving deep into Kubernetes and sharing my learning journey with you. This post is designed to provide a clear and simple introduction to the core components of Kubernetes architecture. Whether you're a beginner or looking to refresh your knowledge, this guide will help you understand the key concepts of Kubernetes.
Today, I am excited to share what I have learned this week about the core components of Kubernetes architecture. Let’s break it down into simple words:
🎈Master Node
The Master Node is the brain of the Kubernetes cluster, managing the entire system and maintaining the desired state of the cluster.
API Server: The central management entity that processes API calls and updates the cluster state. It validates and configures data for the API objects.
etcd: A distributed key-value store that stores all cluster data, including configuration and state information.
Controller Manager: Runs various controllers to ensure the cluster's desired state matches the actual state. Examples include the Node Controller, Replication Controller, and Endpoint Controller.
Scheduler: Assigns pods to worker nodes based on resource availability and constraints. It monitors newly created pods without assigned nodes and selects suitable nodes for them.
🎈Worker Node
Worker Nodes are responsible for running the actual applications and workloads. Each node contains the necessary services to manage networking, communicate with the master node, and run the assigned workloads.
Kubelet: An agent that ensures containers are running in a pod as specified. It registers the node with the Kubernetes cluster, monitors pod and container status, and reports this information to the master node.
Container Runtime: The software responsible for running containers, such as Docker, containerd, or CRI-O. It pulls images, starts and stops containers, and manages container images and storage.
Kube-Proxy: Maintains network rules and manages connectivity within the cluster. It forwards traffic to the appropriate pod based on service definitions and ensures seamless network communication.
🎈API Server
The API Server serves as the front end of the Kubernetes control plane. It handles communication between users, the cluster, and the various components of the system.
Key Functions:
Processes REST API calls from users or CI/CD pipelines.
Validates and configures data for API objects (e.g., pods, services).
Serves as the hub for all cluster communication.
🎈etcd
etcd is a consistent and highly available key-value store used for all cluster data. It is the source of truth for the Kubernetes cluster.
Key Functions:
Stores the entire state of the cluster, including configuration, secrets, and service discovery information.
Provides a reliable way to manage configuration data and maintain cluster state.
🎈Controller Manager
The Controller Manager runs a set of controllers to regulate the state of the cluster. Controllers are responsible for monitoring the state of various resources and ensuring they match the desired state.
Key Controllers:
Node Controller: Monitors and responds to node failures.
Replication Controller: Ensures the desired number of pod replicas are running.
Endpoint Controller: Manages endpoint objects to keep track of pods in services.
🎈Scheduler
The Scheduler is responsible for assigning pods to nodes based on resource availability and other constraints. It ensures efficient utilization of resources across the cluster.
Key Functions:
Watches for newly created pods without assigned nodes.
Selects an appropriate node for each pod based on resource requirements, policies, and constraints.
🎈Kubelet
Kubelet is an agent that runs on each worker node, ensuring that containers are running in a pod as specified by the Kubernetes API.
Key Functions:
Registers the node with the Kubernetes cluster.
Monitors pod and container status.
Reports node and pod status to the master node.
🎈Pod
A Pod is the smallest deployable unit in Kubernetes, representing a single instance of a running process in the cluster. Pods encapsulate one or more containers, along with storage resources, a unique network IP, and options that govern how the containers should run.
Characteristics:
Encapsulates one or more containers.
Shares storage, network, and a specification for how to run the containers.
Acts as a logical host for the containers.
🎈Container Runtime
The Container Runtime is the software responsible for running containers. Kubernetes supports various container runtimes, such as Docker, containerd, and CRI-O.
Key Functions:
Pulls images from container registries.
Starts and stops containers.
Manages container images and storage.
🎈Container
A Container is a lightweight, portable, and self-sufficient executable package that includes everything needed to run a piece of software.
Characteristics:
Isolated from other containers.
Shares the host OS kernel.
Uses images to create container instances.
🎈Kube-Proxy
Kube-Proxy maintains network rules and manages connectivity within the cluster, ensuring that services can communicate with each other.
Key Functions:
Forwards traffic to the appropriate pod based on service definitions.
Manages network rules for services.
🎈Flow of Kubernetes Components
API Server Receives Request:
- User or CI/CD pipeline sends a request to the API Server to deploy an application.
API Server Processes Request:
- Validates the request and stores the configuration in etcd.
Scheduler Assigns Pod:
- Scheduler assigns the pod to an appropriate worker node based on resource requirements and constraints.
Controller Manager Ensures State:
- Ensures the desired number of replicas are running and manages other controllers.
Kubelet on Worker Node:
- Kubelet on the assigned worker node pulls the necessary container images using the container runtime and starts the containers within a pod.
Kube-Proxy Manages Network:
- Kube-Proxy ensures network rules are in place, enabling communication between pods and services.
Pods Running on Worker Nodes:
- Containers within pods run the desired application instances, interacting with each other as needed.
By understanding these components and their interactions, you can effectively manage and troubleshoot a Kubernetes cluster. Each element plays a crucial role in ensuring the seamless operation of containerized applications, making Kubernetes a powerful tool for modern DevOps practices.
For more detailed insights and examples, visit my Hashnode profile. If you have any questions or need further explanations, feel free to reach out!
#kubernetes #devops #microservices #monolithicarchitecture #containerization #docker
Thank you for reading! If you have any questions or suggestions, feel free to leave a comment or reach out to me directly. You can contact me through the following:
Email: muhammad77pro@gmail.com
LinkedIn: Click Here
Let’s continue learning and growing together in the fascinating world of DevOps!
🎈References
I covered all these concepts from the following video tutorial:
- Click Here to watch first video
NOTE: After watching this video, you might be concerned about taking notes. Don't worry; simply click on my GitHub link to access and fork the repository with all the notes. Just keep me in your prayers!
4o