Introduction to Kubernetes
The system that runs containers across many machines, and heals itself when things break.
Docker is great for running containers on one machine. But production needs hundreds of containers across many machines, restarted automatically when they crash and scaled up when traffic spikes. Kubernetes (often written K8s) is the system that manages all of that for you.
🎯 Learning Objectives
By the end of this lesson you will:
- Understand what Kubernetes does and why it exists
- Know the difference between the control plane and worker nodes
- Understand the core objects: Pod, Node, Cluster
- Grasp the idea of declarative configuration
The Problem Kubernetes Solves
Imagine running 200 containers by hand. You’d have to:
- Decide which machine each container runs on
- Restart any container that crashes
- Add more copies when traffic rises, remove them when it falls
- Route traffic to healthy containers only
- Roll out new versions without downtime
Kubernetes automates all of this. You tell it the desired state — “I want 5 copies of this app running” — and it makes reality match, continuously.
💡 Declarative, not imperative
You don’t tell Kubernetes how to do things step by step. You describe the desired state, and Kubernetes constantly works to keep the cluster in that state. This is the single most important idea in K8s.
The Big Picture: a Cluster
A Kubernetes cluster is a set of machines (nodes) working together, split into two roles:
| Part | Role |
|---|---|
| Control plane | The brain — makes decisions, schedules work, watches state |
| Worker nodes | The muscle — actually run your containers |
┌──────────── Control Plane ────────────┐
│ API Server · Scheduler · Controller │
│ etcd (the cluster's memory) │
└───────────────────┬────────────────────┘
│ commands
┌───────────┬───────┴───────┬────────────┐
Node 1 Node 2 Node 3
[Pods...] [Pods...] [Pods...]Key Components
Control plane:
- API Server — the front door; every command goes through it.
- Scheduler — decides which node a new Pod runs on.
- Controller Manager — watches state and fixes drift (e.g. restarts a dead Pod).
- etcd — a key-value store holding the entire cluster state.
Worker nodes:
- kubelet — the agent that runs Pods on the node.
- kube-proxy — handles networking rules on the node.
- Container runtime — actually runs the containers (e.g. containerd).
The Pod — the Smallest Unit
You don’t deploy containers directly in Kubernetes — you deploy Pods. A Pod wraps one (occasionally more) container and is the smallest thing Kubernetes schedules.
💡 Pods are cattle, not pets
Pods are disposable. If one dies, Kubernetes doesn’t nurse it back to health — it throws it away and creates a fresh one. Your app must be designed to handle this, which is what makes it resilient.
See It Yourself
kubectl is the command-line tool for talking to a cluster:
kubectl version --short # client + server versions
kubectl get nodes # list the machines in the cluster
kubectl get pods -A # all pods across all namespacesHere the cluster has one control-plane node and two workers, all Ready.
🧪 Hands-on Lab
Explore a Cluster
- List the nodes in the cluster and note their roles
- List all pods across every namespace
- Describe one node to see its capacity (CPU, memory)
🧠 Knowledge Check
What is the smallest deployable unit in Kubernetes?
What does 'declarative configuration' mean in Kubernetes?
💼 Interview Preparation
What problems does Kubernetes solve that Docker alone does not?
Summary
You now understand what Kubernetes is, the control plane vs worker node split, the core components, and the declarative model built around Pods. Next, you’ll actually run an app using Pods and Deployments.