What is Kubernetes?
Understand what Kubernetes is, the problems it solves, and its core architecture including control plane and worker nodes.
What is Kubernetes?
So you've built an app. It runs in a container. Awesome! You're feeling like a rockstar. But then your boss walks in and says — "Hey, I need 10 copies of this thing running across 5 servers. Oh, and if one crashes, it should restart by itself. And we need rolling updates. And load balancing. By Friday."
Yeah… that's where Kubernetes comes in.
The Problem Kubernetes Solves
Running one container on your laptop? Easy peasy. Running hundreds of containers in production? That's a whole different beast. You need to handle:
- Scaling: More traffic? Spin up more containers. Less traffic? Scale down and save money.
- Self-healing: Container crashed at 3 AM? Start a new one automatically. No pager alerts needed.
- Load balancing: Distribute traffic across healthy containers so no single one is overloaded.
- Rolling updates: Deploy new versions without taking the app offline (because downtime is so 2010).
- Service discovery: Containers need to find each other. And IP addresses change constantly like phone numbers at a startup.
You could script all this yourself with bash and duct tape. Or you could let Kubernetes handle it. Trust me, go with Kubernetes.
What is Kubernetes, Exactly?
Kubernetes (K8s for short — the 8 represents the 8 letters between K and s, because apparently the full name was too long to type) is a container orchestration platform. You tell it what you want ("run 3 copies of my app"), and it figures out how to make that happen.
Wait, what does "orchestration" mean?
Think of Kubernetes as the conductor of an orchestra. Each musician (container) plays their part, but the conductor makes sure they all play in harmony, start on cue, and if someone drops their instrument, a replacement steps in immediately.
Originally developed by Google (they've been running containers at massive scale since before it was cool), it's now open source and maintained by the Cloud Native Computing Foundation (CNCF). Every major cloud provider offers managed Kubernetes: AWS EKS, Google GKE, Azure AKS.
How Kubernetes Works
Kubernetes runs on a cluster — a group of machines working together. Think of it like a team. There are two types of roles:
Control Plane
The brain of the cluster. It makes all the important decisions — like scheduling and detecting when things go wrong. If the cluster were a company, the Control Plane would be the management team.
Alright, what's inside this "brain"?
Key components:
- API Server: The front door. Every single command goes through here. When you run
kubectlcommands, you're basically knocking on the API server's door and saying "Hey, do this for me." - etcd: The cluster's memory (database). It stores all configuration and state. If etcd dies, you lose your cluster. Yeah, it's that important. Back it up!
- Scheduler: The matchmaker. It decides which node runs which container. It considers resource requirements, constraints, and availability — like a seating planner at a wedding.
- Controller Manager: The responsible one. It runs controllers that handle routine tasks — keeping the right number of pods running, managing node failures, etc. It's basically the person who makes sure everybody is doing their job.
Worker Nodes
The machines that actually do the heavy lifting — running your containers. If the Control Plane is management, Worker Nodes are the team actually building the product.
Each node has:
- kubelet: An agent that ensures containers are running as expected. Think of it as a supervisor on each machine — it talks to the control plane and manages containers on its node.
- Container Runtime: The software that actually runs containers. Usually containerd or CRI-O. Docker works too, but isn't recommended for new clusters.
- kube-proxy: The networking guy. Handles all the network traffic and makes sure requests reach the right containers.
Here's a simplified view:
┌─────────────────────────────────────────────────────────┐
│ Control Plane │
│ ┌──────────┐ ┌──────┐ ┌───────────┐ ┌────────────┐ │
│ │API Server│ │ etcd │ │ Scheduler │ │ Controller │ │
│ └──────────┘ └──────┘ └───────────┘ │ Manager │ │
│ └────────────┘ │
└─────────────────────────────────────────────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Node 1 │ │ Node 2 │ │ Node 3 │
│ ┌──────┐ │ │ ┌──────┐ │ │ ┌──────┐ │
│ │ Pod │ │ │ │ Pod │ │ │ │ Pod │ │
│ └──────┘ │ │ │ Pod │ │ │ └──────┘ │
│ ┌──────┐ │ │ └──────┘ │ │ ┌──────┐ │
│ │ Pod │ │ └──────────┘ │ │ Pod │ │
│ └──────┘ │ │ └──────┘ │
└──────────┘ └──────────┘
Key Concepts (Quick Overview)
Don't worry about memorizing all of this right now — you'll learn each one in detail throughout the tutorials. Just get a feel for the vocabulary.
Pod
The smallest unit in Kubernetes. A Pod wraps one or more containers that share storage and network. Think of it as a tiny apartment for your container to live in.
Deployment
The landlord that manages Pods. You tell it "run 3 replicas of my app" and it ensures exactly 3 Pods are always running. If one dies, the Deployment immediately creates a replacement. It also handles rolling updates and rollbacks.
Service
Pods come and go — their IP addresses change every time they restart. A Service is like a permanent phone number that always reaches the right Pods, no matter how many times they move.
Namespace
A way to divide cluster resources. Like folders on your computer. Useful for separating environments (dev, staging, prod) or teams so they don't step on each other's toes.
ConfigMap & Secret
Store configuration data. ConfigMaps for regular stuff (like database hostnames), Secrets for sensitive stuff (like passwords and API keys). Because hardcoding passwords in your code is a crime. Don't do it.
Declarative vs Imperative
Here's something cool about Kubernetes — it's declarative. You describe what you want, not how to get there:
# "I want 3 nginx pods"
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
That YAML looks scary! What does all this mean?
Relax! It's simpler than it looks. You're basically telling Kubernetes: "Hey, I want 3 copies of nginx running." That's it. You don't say "create pod 1, then pod 2, then pod 3." You just say "I want 3 pods" and Kubernetes figures out the rest. Like ordering food at a restaurant — you don't tell the chef how to cook, you just say what you want.
If a pod dies, Kubernetes notices the actual state (2 pods) doesn't match desired state (3 pods) and creates a new one automatically. You didn't have to write that logic. How cool is that?
When to Use Kubernetes
Now, before you go all-in, let's be real — Kubernetes is powerful but it's not always necessary. Use it when you have:
- Multiple services that need to communicate
- Need for automatic scaling based on load
- Multiple replicas for high availability
- Frequent deployments requiring zero downtime
- Teams that need isolated environments in the same cluster
Don't use it for simple apps that run fine on a single server. Kubernetes adds complexity. A basic blog or portfolio site? A simple VPS with Docker Compose will do just fine. Don't bring a rocket launcher to a water gun fight.
What's Next?
In the next tutorial, we'll set up a local Kubernetes cluster using Minikube. You'll have a working cluster on your laptop in about 10 minutes, ready to deploy your first application. Let's go!