Understanding Kubernetes Components: API server, Kubelet, and More

Understanding Kubernetes Components: API server, Kubelet, and More

·

4 min read

Kubernetes is a powerful open-source platform for container orchestration, providing developers and DevOps teams with an efficient way to manage and deploy containerized applications at scale. Kubernetes achieves this through a robust architecture and a suite of components that work together to automate the deployment, scaling, and management of containerized applications.

In this blog post, we will take a closer look at the key components of Kubernetes, including API server, Controller manager, Kube-proxy, etc. We will discuss what each component does, how it relates to other components, and how you can use them to build and manage containerized applications efficiently.

The main components of a Kubernetes cluster are:

Master Components: These are the components that control the Kubernetes cluster's state and manage its overall operation. The master components include:

  • API server

  • Controller Manager

  • Scheduler

  • etcd

Worker Components: These are the components that run on each worker node and are responsible for running the containers and other workloads that make up your application. The worker components include:

  • Kubelet

  • Kube-Proxy

  • Container Runtime

Here's a detailed overview of the Master component of a Kubernetes cluster:

  • API Server: The API server is the central control point of the Kubernetes cluster. It provides a RESTful interface through which you can interact with the cluster. The API server validates and processes requests, stores configuration data in etcd, and communicates with other Kubernetes components to manage the cluster's state.
    The main implementation of a Kubernetes API server is kube-apiserver. kube-apiserver is designed to scale horizontally—that is, it scales by deploying more instances. You can run several instances of kube-apiserver and balance traffic between those instances.

  • Controller Manager:

    The controller manager is responsible for managing various controllers that ensure the cluster's desired state is maintained. The replication controller ensures that a specified number of pod replicas are running at all times, while the endpoint controller maintains the endpoint objects that represent services in the cluster.

    Some types of these controllers are:

    • Node Controller

    • Job Controller

    • EndpointSlice Controller

    • ServiceAccount

  • Scheduler:
    The scheduler is responsible for scheduling the Kubernetes cluster's workloads onto the worker nodes. It selects a suitable node for a new workload based on resource availability and other scheduling constraints.

    Factors taken into account for scheduling decisions include: individual and collective resource requirements, hardware/software/policy constraints, affinity and anti-affinity specifications, data locality, inter-workload interference, and deadlines.

  • etcd:

    etcd is a distributed key-value store that stores the Kubernetes cluster's configuration data. It is the single source of truth for the cluster's configuration data and ensures consistency across the cluster. The etcd database is highly available, meaning that it can survive the failure of any individual node in the cluster.

Worker Components:

Node components run on every node, maintaining running pods and providing the Kubernetes runtime environment.

  1. kubelet: The kubelet is an agent that runs on each worker node and communicates with the Kubernetes control plane to receive instructions on what containers to run and manage. It is responsible for starting and stopping containers and ensuring that they are healthy.
    The kubelet takes a set of PodSpecs that are provided through various mechanisms and ensures that the containers described in those PodSpecs are running and healthy. The kubelet doesn't manage containers which were not created by Kubernetes.

  2. container runtime: The container runtime is the software that runs the containers on the worker node. Common container runtimes used with Kubernetes include Docker, container, and CRI-O.

  3. kube-proxy: The kube-proxy is responsible for managing network traffic to and from the containers running on the node. It is responsible for implementing the Kubernetes service concept by setting up and managing network proxies.
    kube-proxy uses the operating system packet filtering layer if there is one and it's available. Otherwise, kube-proxy forwards the traffic itself

In conclusion, Kubernetes is a powerful open-source platform for container orchestration that provides a highly scalable and resilient infrastructure for deploying and managing containerized workloads. The components of a Kubernetes cluster are divided into two categories: master components and worker components. The master components are responsible for managing the overall state of the cluster, while the worker components are responsible for running and managing application workloads. The master components include the API server, etcd, scheduler, and controller manager, while the worker components include the kubelet, container runtime, kube-proxy, pod networking, and add-ons. Understanding the roles and responsibilities of these components is essential for building and managing a successful Kubernetes cluster. With Kubernetes, organizations can deploy and manage complex containerized applications with ease, ensuring high availability, scalability, and fault tolerance.