DevOps Peach

Docker & Kubernetes · Kubernetes Architecture · Lesson 1 of 5

From monoliths to microservices — why Kubernetes

Kubernetes orchestrates thousands of containers across many nodes according to the desired state you declare.

Practice interactively →

Monoliths and microservices

A monolithic app packs every feature into one unit: change one part and you rebuild and redeploy the whole thing. Microservices split the app into small services that are deployed and scaled independently and talk over APIs. Each service is usually a container image, so the number of containers grows fast.

Container orchestrator

With hundreds of containers on dozens of nodes, you need a system that places containers on nodes, restarts them when they die, scales them and updates them without downtime. Kubernetes (K8s) is the open-source container orchestrator that does exactly that.

flowchart LR
  U["You: YAML manifest<br/>(desired state)"] -- "kubectl apply" --> API["Kubernetes API"]
  API --> C["Controllers compare<br/>desired vs actual"]
  C --> N["Pods on the nodes"]
  N -. "actual state" .-> C

For a small app of a few containers on one server, Docker Compose is often enough; K8s pays off as services, nodes and self-healing needs grow.

Command Meaning
kubectl version kubectl (client) and cluster (server) versions
kubectl apply -f app.yaml Send the desired state to the cluster

What Kubernetes gives you

Capability In practice
Service discovery and load balancing Pods find each other by DNS name; Services spread traffic
Rolling updates and rollback New versions replace pods gradually; kubectl rollout undo goes back
Self-healing Failed containers restart; pods on a dead node are recreated elsewhere
Configuration and secrets ConfigMaps and Secrets injected without rebuilding images
Storage orchestration Volumes from cloud disks or network storage attached automatically
Autoscaling More pods with the Horizontal Pod Autoscaler, more nodes with a cluster autoscaler
Batch work Jobs and CronJobs for one-off and scheduled tasks

The ecosystem

Kubernetes came out of Google's internal Borg experience and was donated in 2015 to the Cloud Native Computing Foundation (CNCF), which also hosts Prometheus, Helm, containerd, and many other projects used in this track. You can run it in many forms: managed services (EKS, AKS, GKE), enterprise platforms (Red Hat OpenShift, Rancher), and lightweight distributions (k3s).

Learning locally

kind (Kubernetes in Docker), minikube, k3d, and the Kubernetes option in Docker Desktop each give you a working cluster on a laptop in minutes. kubectl reads cluster addresses and credentials from ~/.kube/config; kubectl config get-contexts lists clusters and kubectl config use-context kind-lab switches between them.

Costs to be honest about

Kubernetes adds moving parts: networking plugins, ingress controllers, certificates, upgrades every few months, and many YAML files. Teams need monitoring, security policies, and people who understand the platform. Managed services remove the control-plane work but not the need to learn how workloads, networking, and storage behave.

The modules that follow build up step by step: architecture, pods and namespaces, workloads, Services and Ingress, storage and configuration, access control, and finally Helm for packaging.

Practice interactively →