Skip to content
QIO journal

Technology5 min read

Kubernetes in plain terms: why it exists and how a cluster works

Kubernetes runs containers across many machines at once: you describe the desired state of an application and the cluster keeps it that way. Here is what a cluster consists of, what the API Server, etcd, Scheduler and kubelet do, and what happens after a kubectl command.

Kubernetes in plain terms: why it exists and how a cluster works

The problem Kubernetes solves

One container on one server starts with one command. Trouble begins when there are dozens of containers, several servers, and the application must survive a machine failure and grow under load. Kubernetes takes over placing containers on servers, restarting failed ones, scaling and rolling out updates without downtime.

The key idea is desired state. Instead of a sequence of commands you describe the result: three replicas of a service with a given image version. The cluster constantly compares reality with the description and fixes the difference. That loop is called reconciliation.

Several backend copies behind a single entry point for users
Several backend copies behind a single entry point for users

The most common mistake we see: a cluster set up for the sake of 'proper architecture' with nobody to maintain it. A CMS website is fine on one server with backups; Kubernetes starts making sense when someone can be on call.

What a cluster consists of

A cluster splits into the control plane and the worker nodes. A node is a physical server, a virtual machine or a cloud instance. The smallest unit of deployment is a pod: a wrapper around one, sometimes several containers that share network and storage.

  • API Server: the single entry point for every command and query.
  • etcd: the distributed store that holds cluster state.
  • Scheduler: picks a node for every new pod by resources and rules.
  • Controllers: watch for drift between desired and actual state and trigger fixes.
  • kubelet: the agent on each node that starts and monitors pods.
  • Container runtime such as containerd: runs the containers themselves.
A cluster node can be a physical server, a virtual machine or a cloud instance
A cluster node can be a physical server, a virtual machine or a cloud instance
Control Plane nodes and Worker Nodes
Control Plane nodes and Worker Nodes
Cluster structure: Control Plane, worker nodes, pods and the containers inside them
Cluster structure: Control Plane, worker nodes, pods and the containers inside them
Control Plane components: API Server, etcd, Scheduler, Controller Manager
Control Plane components: API Server, etcd, Scheduler, Controller Manager

What happens after kubectl apply

The same five steps repeat on every change. Knowing the chain helps read logs and see where a rollout is stuck.

  • You send a manifest through kubectl to the API Server.
  • The API Server stores the desired state in etcd.
  • Controllers notice the pods do not exist yet and create their objects.
  • The Scheduler assigns each pod to a node.
  • The kubelet on that node starts the containers through the runtime and reports status.
etcd stores the desired state: nodes, deployments, pods, services, configuration
etcd stores the desired state: nodes, deployments, pods, services, configuration
The Scheduler picks a node, kubelet supervises the pod, the container runtime starts containers
The Scheduler picks a node, kubelet supervises the pod, the container runtime starts containers
The path of a kubectl command: API Server, etcd, Scheduler, Controllers and worker nodes
The path of a kubectl command: API Server, etcd, Scheduler, Controllers and worker nodes

When you need Kubernetes and when you do not

Kubernetes pays off when there are many services, load varies and downtime is expensive: an online store with peaks, a product with several teams, a SaaS shipping several times a day. For a corporate website, a landing page or a small 1C-Bitrix store a cluster is overkill: one server with backups and monitoring is cheaper to run and easier for contractors to understand.

If in doubt, count the cost of ownership, not the cost of launch: who maintains the cluster, who is on call at night and how long training takes.

Summary

Kubernetes keeps an application in the state you described across a group of machines. The control plane decides, nodes execute, etcd remembers. Most small-business websites do not need it; products with constant releases and variable load treat it as the standard.

Sources

  1. Kubernetes documentation: cluster components
  2. Kubernetes explained simply, part 1 (Habr, in Russian)
  3. etcd documentation
  • Kubernetes
  • Container
  • etcd
  • containerd
  • kubectl

Follow the journal

New pieces on websites, SEO and AI come out in the QIO journal. Follow in Google, by RSS or in Telegram to get them first.

Read next

How can we help?
Discuss a project