What Is Kubernetes? A Beginner's Guide to Container Orchestration
You've created containers with Docker — great. But when you have 50 containers, who manages them? Which one crashed? Which needs more resources? Kubernetes (K8s) is the conductor that brings order to this chaos.
Definition
Kubernetes is a container orchestration platform originally developed by Google and released as open source. It automatically deploys, scales, and manages containerized applications.
Core Concepts
Pod
The smallest deployable unit in Kubernetes. Hosts one or more containers:
apiVersion: v1
kind: Pod
metadata:
name: api-server
spec:
containers:
- name: api
image: myapp/api:v1.2
ports:
- containerPort: 3000
Node
The physical or virtual machine where Pods run. Two types:
- Master Node — Manages the cluster (API Server, Scheduler, Controller)
- Worker Node — Runs the Pods
Service
Provides a stable network address for Pods. Pods come and go, but the Service stays at the same address:
apiVersion: v1
kind: Service
metadata:
name: api-service
spec:
selector:
app: api-server
ports:
- port: 80
targetPort: 3000
type: LoadBalancer
Deployment
Defines the desired state of Pods. Kubernetes works to match reality to this definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
spec:
replicas: 3
selector:
matchLabels:
app: api-server
template:
metadata:
labels:
app: api-server
spec:
containers:
- name: api
image: myapp/api:v1.2
This says "always run 3 api-server Pods." If one crashes, K8s automatically starts a new one.
Kubernetes Architecture
┌─────────────────────────────────┐
│ MASTER NODE │
│ ┌──────────┐ ┌──────────┐ │
│ │API Server│ │Scheduler │ │
│ └──────────┘ └──────────┘ │
│ ┌──────────┐ ┌──────────┐ │
│ │Controller│ │ etcd │ │
│ │Manager │ │(key-val) │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────┘
↕ ↕
┌──────────┐ ┌──────────┐
│Worker │ │Worker │
│Node 1 │ │Node 2 │
│┌──┐ ┌──┐│ │┌──┐ ┌──┐ │
││P1│ │P2││ ││P3│ │P4│ │
│└──┘ └──┘│ │└──┘ └──┘ │
└──────────┘ └──────────┘
When to Use Kubernetes
✅ Good Fit
- 10+ microservices
- High availability requirements
- Auto-scaling needs
- Multi-cloud or hybrid cloud strategy
- Teams with strong DevOps maturity
❌ Skip It
- Small projects (1-3 services)
- Simple websites
- Teams without DevOps experience
- Cost-constrained projects
Alternatives
| Solution | Advantage | When? | |----------|-----------|-------| | Docker Compose | Simple, local dev | Single server | | Google Cloud Run | Serverless, no management | Simple containers | | AWS ECS | AWS integration | AWS ecosystem | | Nomad | Lightweight, simpler than K8s | Medium scale |
Conclusion
Kubernetes is powerful but complex. Evaluate whether you truly need it. For most startups and SMBs, managed solutions like Cloud Run or ECS are sufficient. The transition to Kubernetes should align with your team's maturity.
Learn container orchestration and Kubernetes interactively on the DevOps career path at LabLudus.