Every Kubernetes cluster comes with a set of standard components that take up the responsibility of running a cluster smoothly. In this post, we will take a look at the various Kubernetes components and their role in running a Kubernetes cluster.
Before going further into the architecture of Kubernetes, it is important to understand the most basic object, called POD. A pod is the smallest computing unit that can be deployed in a Kubernetes cluster. Pods usually run one or more containers. All the containers in a pod share the pod’s IP address, hostname, shared volumes, etc. Kubernetes uses pods to achieve replication.
Every Kubernetes cluster can be divided into two sets of components:
- Control plane components
- Node components
Control plane components
The control plane components are responsible for cluster management.
- API Server (kube-apiserver): The API server is the most essential component of the Kubernetes control plane. It exposes the Kubernetes REST api and provides a frontend to the control plane. All operations in a Kubernetes cluster are performed using REST API calls to the API server (Ex: POST API call to create new resources and GET API call to fetch the resource status).
- etcd: Used to store all the Kubernetes cluster data (configuration, state). It’s a distributed, highly available key-value store.
- Scheduler (kube-scheduler): The scheduler is responsible for monitoring the available resources on the nodes and assigning the pods to the nodes. The scheduler ensures that the cluster workloads are evenly distributed.
- Controller manager (kube-controller-manager): The controller manager keeps track of the current cluster state through the API server and makes changes as needed to ensure the current cluster state is always in sync with the desired state stored in etcd.
- Cloud controller manager (cloud-controller-manager): The cloud controller manager is responsible for connecting the Kubernetes clusters with the underlying cloud provider’s infrastructure API.
Nodes are where the Kubernetes workloads are run. Pods are distributed across the available pool of nodes and the containers, part of each pod, are deployed on the nodes.
- Kubelet (kubelet): Kubelet is the main process running on every node. It interacts with the API server to apply the desired configuration for its node and also keeps the Control plane informed about the node’s health, performance and workloads.
- Kube proxy (kube-proxy): Kube proxy runs on each node and ensures proper communication between the pods, nodes, and the external network using iptables rules.
- Container runtime (Docker, Containerd, CRI-O): The container runtime is responsible for running the containers on the nodes. The most popular runtime is Docker. Kubernetes also supports containerd and CRI-O container runtimes.