Guest mode. You can read posts without signing up. Comments, ratings, job contacts and your own posts open after you sign up and accept the rules. What is Kommit →

Редакция КоммитРедакция портала
commit f3d9e81 · 15 days ago

Kubernetes, Part 1: What It Is, How It Differs from Docker Compose, and When You Really Need It

🌐 Machine-translated from Russian. Show original

In this part:

In simple terms#

  • A container is an application with all dependencies, packaged in an image. You already know this from Docker.
  • Docker Compose — describes multiple containers on one server in a single YAML file.
  • Kubernetes (k8s) is an "operating system for a group of servers": you describe what should work ("3 copies of the application available at app.example.kz address"), and Kubernetes decides where to start containers, restarts the downed ones, moves them from the failed server, and updates without downtime.

The key idea is declarativeness: you store the desired state in YAML, and Kubernetes constantly brings reality to it.

How a cluster is structured#

PartWhat does
Control planeAPI server, scheduler, controllers, state store**, etc**
Worker nodesrun containers: kubelet, container runtime environment, network proxy,
kubectlconsole client: all commands go through the
CNInetwork between pods at different nodes
CSIconnecting disks and storage
Ingress / GatewayHTTP(S) traffic input from outside

Docker Compose or Kubernetes#

Docker ComposeKubernetes
Serversonefrom one to hundreds of
Server failureapplication lies idle untilcontainers move to other nodes (if there are several nodes)
Updating without downtimemanually, scriptsbuilt-in: rolling update, rollback with a single command
Scalingmanuallya single command or automatically by load
Entry thresholdeveningweek to confidently operate
Resources for "binding"almost zero0.5–1 GB of RAM per node for service components
Who is suitable1–2 servers, a small team,many services, multiple servers, availability requirements,

When Kubernetes is not needed#

  • One or two apps on one server, and 10-minute downtime during updates doesn't bother anyone.
  • There is no one who will understand the cluster and be responsible for it. Kubernetes without a host is worse than Compose with a host.
  • The main system is 1C, AD, and file servers. They live in virtual machines, not containers.
  • Databases "because everything is in k8s." A DBMS in Kubernetes is possible (part 4), but requires experience; a standalone VM with PostgreSQL is often easier — see the "PostgreSQL for Administrator" series.

When Kubernetes is justified#

  • A dozen or more services, each with its own versions and updates.
  • Work without downtime is needed when the server fails and when new versions are uploaded.
  • Multiple development teams share a single infrastructure.
  • I want a single way to deploy: test, pre-product, and prod are described the same way and lie in Git.

Which Kubernetes to Choose#

VariantWhat isWhen to take
k3sa lightweight certified distribution, one binary, set by one commandlearning, one server, small clusters, branches — we take this series
kubeadmthe official vanilla-cluster building toolwant to understand every component, large clusters,
RKE2, Talos, other distributions,ready-made builds focused on security or immutable OSproduction once you have mastered the basics of
Managed Kubernetes in the cloudcontrol plane is served by a providerno desire to serve management nodes (part 6)
minikube, kindcluster on a laptoponly for development and experimentation

k3s is full-fledged Kubernetes: the same manifests, the same kubectl, the same Helm. Everything you learn on it works in any other cluster.

What you'll need for the series#

  • Server or VM with Ubuntu Server 24.04: minimum 2 vCPUs, 4 GB RAM, 40 GB SSD (k3s itself requires at least 2 cores and 2 GB, the rest for applications). Installing Ubuntu is in the "Linux Server and KVM" series.
  • For part 5 — another 2–4 such VMs.
  • Knowledge of Docker: images, registry, environment variables, volumes.
  • For HTTPS — a domain and the ability to create a DNS record.

Series Dictionary#

ObjectAnalog in Docker Compose
Podone or more containers running together
Deploymentservice with replicas and update rules
Servicea permanent name and address within the cluster (as a service name in a compose network)
Ingressreverse proxy (nginx/Traefik) before
ConfigMap / Secretenvironment: and configuration files / secrets
PersistentVolumeClaimnamed volume volumes:
Namespacea separate compose project

Next is Kubernetes, part 2: we install k3s on one server, kubectl, access from a desktop PC, and the first commands.

Comments 00 участников · 1 гость🔒 Rate and discuss after signing up

Comments · 0

No comments yet.Sign in to comment, rate and see all comments.