Kubernetes: Overview and Working of all K8s Components

Sachin Singla
5 min readJul 19, 2020

--

Kubernetes (often abbreviated asK8S), is a container orchestration platform for applications that run on containers.

Kubernetes provides everything you need to support your complex container apps. It is the most convenient and popular framework for both developers and operations, widely used by the Dev-ops teams of almost all organizations.

Kubernetes is to a computer cluster what an Operating System is to a computer.

Kubernetes works by grouping containers that make up an application into logical units for easy management and discovery. It’s particularly useful for microservice applications, apps made up of small and independent services that come together to create a more meaningful app.

Although Kubernetes runs on Linux, it is platform-agnostic and can be run on bare metal, virtual machines, cloud instances, or OpenStack.

Computers or nodes in a Kubernetes cluster are divided into the Control Plane and the Workload Plane.

The architecture of a Kubernetes cluster

A Kubernetes cluster consists of nodes divided into two groups:

  • A set of master nodes that host the Control Plane components, which are the brains of the system, since they control the entire cluster.
  • A set of worker nodes that form the Workload Plane, which is where your workloads (or applications) run.

The two planes together make up the Kubernetes cluster.

The Kubernetes Master Node

This is the Kubernetes control panel or control plane. This is where decisions are made about the cluster, such as scheduling, and detecting/responding to cluster events. The components of the master can be run on any node in the cluster. Below is a breakdown of each of the key components of the master:

  • API Server
  • Cluster Data store (etcd)
  • Controller Manager
  • Scheduler
  • Dashboard (optional)

The components of the Kubernetes Control plane

Let’s discuss each of these components one by one.

API Server

This is the only component of the Kubernetes control panel with a user-accessible API and the sole master component that you’ll interact with. The API server exposes a restful Kubernetes API and consumes JSON manifest files.

The Kubernetes API Server exposes the RESTful Kubernetes API. Engineers using the cluster and other Kubernetes components create objects via this API.

Cluster Data Store

Kubernetes uses “etcd.” This is a strong, consistent, and highly-available key value store that Kubernetes uses for persistent storage of all API objects. Think of it as the “source of truth” for the cluster.

The etcd distributed datastore persists the objects you create through the API, since the API Server itself is stateless. The Server is the only component that talks to etcd.

Controller Manager

Known as the “kube-controller manager,” this runs all the controllers that handle routine tasks in the cluster. These include the Node Controller, Replication Controller, Endpoints Controller, and Service Account and Token Controllers. Each of these controllers works separately to maintain the desired state.

Controllers bring to life the objects you create through the API. Most of them simply create other objects, but some also communicate with external systems (for example, the cloud provider via its API).

Scheduler

The scheduler watches for request for newly-created pods (groups of one or more containers) and assigns them to nodes.

The Scheduler decides on which worker node each application instance should run.

This is how the interaction between the components of Master and Worker Nodes takes place.

Kubernetes Worker Nodes

Whereas the master handles and manages the cluster, worker nodes run the containers and provide the Kubernetes runtime environment.

Major Components are:

  • Kubelet
  • Container runtime
  • Kube-proxy

The Kubernetes components that run on each worker node.

Let’s discuss each of these components one by one.

Kubelet

Worker nodes comprise a kubelet. This is the primary node agent. It watches the API server for pods that have been assigned to its node. Kubelet carries out tasks and maintains a reporting backchannel of pod status to the master node.

The Kubelet, an agent that talks to the API server and manages the applications running on its node. It reports the status of these applications and the node via the API.

Container Runtime

Inside each pod there are containers, kubelet runs these via Docker (pulling images, starting and stopping containers, etc.). It also periodically executes any requested container liveness probes. It supports Docker and RKT.

The Container Runtime, which can be Docker or any other runtime compatible with Kubernetes. It runs your applications in containers as instructed by the Kubelet.

Kube-proxy

This is the network brain of the node, maintaining network rules on the host and performing connection forwarding. It’s also responsible for load balancing across all pods in the service.

The Kubernetes Service Proxy (Kube Proxy) load-balances network traffic between applications.

Add-on components

Most Kubernetes clusters also contain several other components. This includes a DNS server, network plugins, logging agents and many others.

They typically run on the worker nodes but can also be configured to run on the master.

Kubernetes in Action

Steps followed in Deploying an application to Kubernetes.

These actions take place when you deploy the application:

  • You submit the application manifest to the Kubernetes API. The API Server writes the objects defined in the manifest to etcd.
  • A controller notices the newly created objects and creates several new objects — one for each application instance.
  • The Scheduler assigns a node to each instance.
  • The Kubelet notices that an instance is assigned to the Kubelet’s node. It runs the application instance via the Container Runtime.
  • The Kube Proxy notices that the application instances are ready to accept connections from clients and configures a load balancer for them.
  • The Kubelets and the Controllers monitor the system and keep the applications running.

Kubernetes is a great technology and you will be able to appreciate only when you try it hands-on.

Thanks for reading this article.

For more such blogs, you can follow me, so that you get notified every time I come up with a new post.

Cheers!

Also, Let’s get connected on LinkedIn, GitHub and Twitter.

--

--

Sachin Singla

Programmer-Developer-Engineer-Enthusiast-Explorer-Leader