Day 29 Task: Kubernetes Architecture

Hey there! I am Pradeep Chitroliya I am a Devops engineer, started writing articles on my DevOps and cloud journey. My purpose is to share the concepts that I learn, the projects that I build, and the tasks that I perform regarding DevOps. Hope you all find it useful.
Kubernetes
Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Containers are a lightweight and portable way to package and run applications, and Kubernetes provides a framework for automating the deployment and management of these containers.
With Kubernetes, you can define how your applications should run, scale them up or down based on demand, manage changes to existing containerized applications, and optimize the use of underlying hardware beneath your containers. It simplifies the deployment and operation of applications, allowing developers to focus on writing code without worrying about the underlying infrastructure.
Tasks:-
Q.1 What is Kubernetes.
Ans: Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. Containers are a lightweight and portable way to package and run applications, and Kubernetes provides a framework for automating the deployment and management of these containers.
Q.2 What are the benefits of using k8s?.
Ans: Container Orchestration, Scalability, High Availability, Declarative Configuration, Service Discovery and Load Balancing, Rolling Updates and Rollbacks, Resource Efficiency, Portability and Multi-Cloud Deployment, Extensibility, Community and Ecosystem, Security.
Q.3 Explain the architecture of Kubernetes.
ans: according to below diagram of k8s that we know two type node in k8s which are 1. Master node 2. worker node

1.Master node: mange to worker node in which are run the application.it is control plane in k8s.
Master node component::::::
1.EDCT:-
etcd is a distributed key-value store that stores the configuration data of the cluster. It holds the state of the entire cluster, including configuration details, the state of nodes, and metadata.
2.Kube-api server
The API server is the central management point for the Kubernetes cluster. It exposes the Kubernetes API, which is used to interact with the cluster. All administrative tasks and communication with the cluster components go through the API server.
3.kubi-controller manager
The controller manager is responsible for maintaining the desired state of the cluster. It includes various controllers that watch the state of the cluster through the API server and take corrective actions to ensure the desired state is maintained.
4. Kube-**Scheduler
The scheduler is responsible for placing containers onto nodes in the cluster based on resource requirements, policies, and other constraints. It makes decisions about where to run containers to optimize resource utilization and meet application requirements.
worker Node component
1. Kubelet ;-
The Kubelet is an agent that runs on each node in the cluster. It is responsible for communicating with the API server and ensuring that containers are running on the node as expected. It watches for changes in the desired state and takes actions to maintain the specified state.
2.Kube Proxy
Kube Proxy is a network proxy that runs on each node. It maintains network rules to allow communication between containers across the cluster. It also performs load balancing for services.
3. Container Runtime
The container runtime is responsible for pulling container images and running containers. Kubernetes supports various container runtimes, with Docker being a commonly used one.
Q.4 What is Control Plane
Ans: In Kubernetes, the control plane (or master node) is the set of components that manage and control the state of the cluster. It acts as the central coordination and decision-making entity for the entire Kubernetes cluster. The control plane components interact with each other and respond to changes in the cluster, ensuring that the desired state specified by users is maintained.
Q.5 Write the difference between kubectl and kubelets.
Ans: Kubectl is a command-line tool used by administrators and developers to manage and interact with the cluster from a client perspective.
kubeletis an agent running on each node that takes care of the containers and pods on that node, ensuring they are running as specified and reporting back to the control plane.
Q.6 Explain the role of the API server.
Ans: The API server in Kubernetes plays a central and critical role in the control plane. It serves as the primary interface for communication between various components within the cluster, as well as external entities such as administrators, developers, and other systems interacting with the cluster. Here are the key roles and functions of the API server:
Endpoint for Kubernetes API:
- The API server exposes the Kubernetes API, providing a standardized and consistent way for users, applications, and other components to interact with the Kubernetes cluster. The API is RESTful and allows users to perform operations like creating, updating, deleting, and querying resources within the cluster.
Authentication and Authorization:
- The API server is responsible for authenticating requests made to the Kubernetes API. It verifies the identity of users or components making requests, ensuring that they have the necessary permissions to perform the requested actions. Authorization policies, such as Role-Based Access Control (RBAC), are enforced by the API server to control access to resources.
Validation and Defaulting:
- Before persisting resources in the cluster's etcd database, the API server validates the incoming resource specifications. It checks for correct syntax, required fields, and adherence to resource schemas. If a request passes validation, the API server may apply default values to fields that were not specified, ensuring consistency in resource configurations.
Etcd Interaction:
- The API server interacts with the distributed key-value store, etcd, to read and write the current state and configuration of the cluster. Etcd stores information such as pod definitions, service details, and configuration settings. The API server ensures that the cluster's desired state is consistent with what is stored in etcd.
Controller Communication:
- The API server communicates with various controllers in the control plane, such as the Controller Manager and the Scheduler. It receives updates from controllers about changes in the cluster's state and is responsible for distributing those updates to other relevant components.
Admission Control:
- Admission controllers are plugins in the API server that intercept and validate requests before they are persisted in etcd. They enforce additional policies and constraints, allowing administrators to customize the behavior of the API server based on their organization's requirements.
Resource Handling:
- The API server manages a variety of resources, including pods, services, deployments, and more. It handles the lifecycle of these resources, ensuring that they are created, updated, and deleted as specified by users or controllers.
Communication with Kubelet:
- The API server communicates with the
kubeleton each node to schedule and monitor the execution of pods. It instructskubeleton which pods to run and receives updates on their status.
- The API server communicates with the
Thanks for read my blog if you like this blog please like and commend.
Contact me on linkedin
check out my GitHub for more resource GitHub



