☸Day 30 - Kubernetes Architecture

☸Day 30 - Kubernetes Architecture

💮Kubernetes Overview

Kubernetes is opensource container orchestration tool, It provides auto-scaling, self-healing , service discovery, load balancing, and support for rolling updates and rollbacks complete orchestration.With the widespread adoption of containers among organizations, Kubernetes, the container-centric management software, has become a standard to deploy and operate containerized applications and is one of the most important parts of DevOps.

Originally developed at Google and released as open-source in 2014. Kubernetes builds on 15 years of running Google's containerized workloads and the valuable contributions from the open-source community. Inspired by Google’s internal cluster management system, Borg.

💮What is Kubernetes? Why do we call it k8s?

-> Kubernetes is an open-source container orchestration platform originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF). It automates the deployment, scaling, and management of containerized applications, providing a platform for deploying and operating applications in a highly scalable and fault-tolerant manner.

The name "Kubernetes" is derived from Greek, meaning "helmsman" or "pilot." It symbolizes Kubernetes' role as a tool for steering and navigating complex containerized environments.

The abbreviation "k8s" is a shorthand notation for Kubernetes. The "k8" represents the eight letters between "k" and "s" in the word "Kubernetes." Using this abbreviation helps to save time and space, especially in written communication or when typing commands in a terminal. It has become a common convention within the Kubernetes community and is widely used in documentation, discussions, and command-line interfaces.

💮What are the benefits of using k8s?

Using Kubernetes (K8s) offers a wide range of benefits for organizations looking to deploy and manage containerized applications efficiently.

  1. Scalability: Kubernetes enables horizontal scaling of applications, allowing them to handle increased traffic or workload demands. It automatically scales the number of container replicas based on resource utilization metrics, ensuring optimal performance without manual intervention.

  2. Portability: Kubernetes provides a consistent environment for running your applications, making it easy to move them between different cloud providers or on-premises environments.

  3. Resilience: Kubernetes provides built-in mechanisms for fault tolerance and self-healing. It automatically restarts failed containers, replaces unhealthy nodes, and redistributes workloads to healthy nodes, ensuring high availability and minimizing downtime.

  4. Automation: Kubernetes automates repetitive tasks such as deployment, scaling, updates, and monitoring, reducing operational overhead and enabling faster time-to-market for applications. It supports declarative configuration, allowing operators to define the desired state of the cluster and let Kubernetes handle the implementation details.

  5. Service Discovery and Load Balancing: Kubernetes provides built-in service discovery and load balancing mechanisms, enabling communication and networking between microservices within the cluster. It automatically assigns stable IP addresses to services and distributes incoming traffic across multiple pods, ensuring reliability and performance.

⛑Explain the architecture of Kubernetes

  1. Master (Server): The master node is responsible for managing the Kubernetes cluster. It consists of several components:

    • API Server: The API server is the central management point for the Kubernetes cluster. It exposes the Kubernetes API, which allows users to interact with the cluster,It's the main entry point for all administrative tasks and information exchange within the cluster.

    • Scheduler: The scheduler is responsible for placing containers onto nodes in the cluster. It takes into account factors such as resource requirements, node capacity, and other constraints,It assigns them to specific nodes based on available resources and requirements.

    • Controller Manager: The controller manager is responsible for managing various controllers that handle different aspects of the cluster, such as replication, endpoints, and nodes.

    • etcd: etcd is a distributed key-value store that is used to store the cluster's state. It is used by the API server and other components to store configuration and runtime state information.

  2. Node (Worker): A node is a worker machine in the Kubernetes cluster. Each node runs several components:

    • Kubelet: The kubelet is responsible for communicating with the master node and managing containers on the node.

    • kube-proxy: The kube-proxy is responsible for handling network communications to and from the pods running on the node.

    • Container Runtime: The container runtime is responsible for running containers on the node, such as Docker or containerd.

  3. A pod is the smallest unit in Kubernetes and can contain one or more containers. These containers work together and share resources like storage and networking.

💮What is Control Plane?

The Control Plane, often referred to as the master node in a Kubernetes cluster, is like the brain of the operation. It's responsible for managing and coordinating all activities within the cluster. Think of it as the central command center where decisions are made and instructions are sent out to keep everything running smoothly. components of control plane consist of ->API Server, Scheduler,etcd,controller manager.

💮What is the difference between kubectl and kubelets?

-> Here's a breakdown of the differences between kubectl and kubelet:

  1. Purpose:

    • kubectl: kubectl is a command-line interface (CLI) tool used for interacting with Kubernetes clusters. It allows users to perform various tasks, such as deploying applications, inspecting cluster resources, managing configurations, and troubleshooting issues.

    • kubelet: kubelet is an agent that runs on each worker node in a Kubernetes cluster. It's responsible for managing and maintaining the state of pods on the node. kubelet receives pod specifications from the Kubernetes API server and ensures that the containers defined in the pods are running and healthy on the node.

  2. Functionality:

    • kubectl: kubectl provides a wide range of functionalities for managing Kubernetes clusters, including creating, deleting, updating, and scaling resources like pods, services, deployments, and namespaces. It also supports operations such as port-forwarding, logs retrieval, exec into containers, and managing cluster-wide configurations.

    • kubelet: kubelet primarily focuses on managing the lifecycle of pods on the node. It interprets pod specifications (manifests) received from the API server, pulls container images, starts and stops containers, and monitors their health. Additionally, kubelet reports node status and resource utilization back to the control plane.

  3. Location:

    • kubectl: kubectl is typically installed on a user's local machine or workstation. It interacts with the Kubernetes API server, which could be running on a remote server or within the cluster itself.

    • kubelet: kubelet runs as a system service on each worker node within the Kubernetes cluster. It operates directly on the node and is responsible for managing containers and pods locally.

  4. User Role:

    • kubectl: kubectl is primarily used by administrators, developers, and operators who need to manage and interact with Kubernetes clusters. It provides a powerful interface for controlling cluster resources and performing administrative tasks.

    • kubelet: kubelet is managed by the Kubernetes system and typically does not require direct interaction from users. It operates autonomously on each worker node, ensuring that the containers and pods specified in the cluster's configuration are running as expected.

In summary, while both kubectl and kubelet are essential components of a Kubernetes environment, they serve different purposes and target different user roles. kubectl is a versatile CLI tool for managing Kubernetes clusters, while kubelet is a node agent responsible for managing pod lifecycle on individual worker nodes.

🚧Conclusion

this chat topic provided valuable insights into Kubernetes, covering its architecture, key components, and core concepts. From understanding the roles of the Control Plane components to grasping the functionalities of kubectl and kubelet, we've gained a foundational understanding of how Kubernetes orchestrates containerized applications. Delving into topics like the API Server's pivotal role in managing cluster resources highlighted the significance of these components in ensuring the seamless operation of Kubernetes environments. Armed with this knowledge, readers can embark on their Kubernetes journey with confidence, equipped to deploy, manage, and scale applications effectively in modern cloud-native environments.

Happy Learning:)

Did you find this article valuable?

Support Vivek's Blog by becoming a sponsor. Any amount is appreciated!