Day2: Kubernetes Architecture :

Kubernetes Architecture

The architecture of Kubernetes is divided into Master Nodes and Worker Nodes, forming a cluster.

  1. Master Node:

    • API Server: Acts as the front end for the Kubernetes control plane. It exposes the API and handles incoming requests for cluster state changes.

    • Controller Manager: Ensures that the desired state of the cluster is maintained, such as ensuring the correct number of replicas for a service or managing node health.

    • Scheduler: Decides which worker nodes should run specific containers based on resource requirements and availability.

    • etcd: A distributed key-value store that maintains the cluster's configuration data, state, and metadata.

  2. Worker Node:

    • Kubelet: An agent that ensures containers are running in a Pod (the smallest unit of deployment in Kubernetes) on the worker node.

    • Kube Proxy: Maintains network rules for Pod communication, allowing services to be exposed and ensuring load balancing between containers.

    • Container Runtime: The software responsible for running the containers (e.g., Docker, contained).

  3. Control Plane in Kubernetes

    The Control Plane manages the cluster’s overall state, consisting of:

    • API Server: Exposes the Kubernetes API and manages communication with the cluster.

    • etcd: A key-value store holding the cluster's state and configuration.

    • Scheduler: Decides where to place containers based on resources.

    • Controller Manager: Manages controllers responsible for cluster functions.


kubectl vs kubelet

  • kubectl: A command-line tool used to interact with the Kubernetes API for deploying and managing resources.

  • kubelet: A node-level agent that manages containers on worker nodes, ensuring they are running correctly.


Role of the API Server

The API Server:

  • Exposes the Kubernetes API for interaction.

  • Manages cluster state and stores data in etcd.

  • Handles security via authentication and authorization.

  • Integrates with external tools and custom controllers.


Role of the Kubelet

The Kubelet:

  • Ensures containers are running on worker nodes.

  • Manages container health and resource usage.

  • Communicates with the container runtime (e.g., Docker).


What is etcd?

etcd is a distributed key-value store that holds the configuration and state data of the Kubernetes cluster. It ensures consistency and reliability across the cluster using the Raft consensus algorithm.


Conclusion

Kubernetes offers a scalable platform for managing containerized applications. Its architecture, including the control plane, API server, etcd, kubelet, and tools like kubectl, ensures efficient resource management and high availability.