Introduction to Kubernetes
Kubernetes (often abbreviated as K8s — "K", 8 letters, "s") is an open-source platform for automating the deployment, scaling, and management of containerized applications. This tutorial takes you from zero to comfortably running real workloads on a cluster.
Why does Kubernetes exist?
Containers (Docker, containerd, etc.) solved the packaging problem: your app and its dependencies travel together as one image that runs the same everywhere. But once you move past a single machine, new questions appear:
- Where should each container run when you have dozens of servers?
- What happens when a container crashes, or an entire server dies at 3 AM?
- How do you roll out a new version without downtime — and roll back when it misbehaves?
- How do containers find and talk to each other as they move between machines?
- How do you add capacity when traffic spikes and remove it when it drops?
Kubernetes answers all of these. It is a container orchestrator: you describe the state you want ("run 3 replicas of this image, expose them on port 80"), and Kubernetes continuously works to make reality match that description.
What Kubernetes gives you
| Capability | What it means |
|---|---|
| Self-healing | Restarts failed containers, replaces pods on dead nodes, kills containers that fail health checks. |
| Horizontal scaling | Scale an app up or down with one command, or automatically based on CPU/memory/custom metrics. |
| Service discovery & load balancing | Gives pods stable DNS names and IPs, and spreads traffic across replicas. |
| Automated rollouts & rollbacks | Deploys new versions gradually and can revert instantly if something breaks. |
| Config & secret management | Injects configuration and credentials without rebuilding images. |
| Storage orchestration | Mounts local disks, cloud volumes, or network storage into containers on demand. |
| Bin packing | Schedules containers onto nodes efficiently based on their resource requests. |
Kubernetes vs. Docker
A common point of confusion: Docker and Kubernetes are not competitors — they operate at different layers.
- Docker builds container images and runs individual containers on one machine.
- Kubernetes coordinates many containers across many machines. It uses a container runtime (containerd, CRI-O) under the hood to actually run them.
Think of Docker as the shipping container and Kubernetes as the port authority deciding which ship carries which containers, replacing lost ones, and routing cargo.
The vocabulary you'll meet in this tutorial
| Object | One-line definition |
|---|---|
| Cluster | A set of machines (nodes) managed by Kubernetes as one unit. |
| Node | A single worker machine (VM or physical server) that runs your containers. |
| Pod | The smallest deployable unit — one or more tightly coupled containers sharing network and storage. |
| Deployment | Manages a set of identical pod replicas and handles rolling updates. |
| Service | A stable network endpoint that load-balances across a set of pods. |
| Ingress | HTTP(S) routing from outside the cluster to services inside it. |
| ConfigMap / Secret | Configuration data and credentials injected into pods. |
| Namespace | A virtual sub-cluster used to group and isolate resources. |
Try it yourself: a local cluster in minutes
You don't need a cloud account to learn Kubernetes. Any of these run a full cluster on your laptop:
- minikube — the classic single-node learning cluster (
minikube start). - kind — "Kubernetes in Docker", great for fast, disposable clusters (
kind create cluster). - k3s / k3d — a lightweight distribution popular for edge and dev machines.
- Docker Desktop — has a built-in one-click Kubernetes cluster (Settings → Kubernetes).
You will also need kubectl, the command-line client used throughout this tutorial. Verify everything works:
# Check the client is installed
kubectl version --client
# List the clusters kubectl knows about
kubectl config get-contexts
# Confirm the cluster is reachable
kubectl cluster-info
kubectl get nodes
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 2m v1.30.0
kubectl commands. Keep a local cluster open in a terminal and try them as you read — it is by far the fastest way to learn.How this tutorial is organized
- Getting Started — this page, plus the cluster architecture that everything else builds on.
- Core Workloads — Pods, Deployments & ReplicaSets, and scaling them manually and automatically.
- Networking — Services for in-cluster traffic and Ingress for HTTP traffic from outside.
- Config & Storage — ConfigMaps, Secrets, Volumes, PersistentVolumes, and StorageClasses.
- Operations — Namespaces, RBAC security, and a kubectl cheat sheet you'll come back to daily.
Use the sidebar to jump to any concept, or the Next button below to follow the recommended path.