Docker is a fantastic tool for creating and running containerized boxes on your computer. But what happens when tech giants like Spotify, Netflix, or BookMyShow need to run thousands of containers simultaneously across hundreds of cloud servers? Managing them manually, checking if they crash, and connecting them to the network becomes a logistical nightmare.
This is why we use Kubernetes (often called K8s). It acts as the ultimate automated supervisor for all your containers.
The Cargo Ship Captain Metaphor
If a single Docker container is a standardized metal shipping box, then a large web application is a massive cargo ship loaded with 10,000 boxes. If boxes are loaded incorrectly, the ship will tip over. If a box starts leaking or falls off, the cargo is lost. You need a captain to supervise everything.
Kubernetes is the Cargo Ship Captain. K8s coordinates where to stack containers based on server capacity (RAM and CPU), monitors if containers crash and restarts them, and acts as a harbor master directing network traffic so everything moves smoothly.
Real-World Example: Hotstar During an IPL Cricket Match
Imagine Hotstar is streaming an IPL cricket final. On a normal weekday morning, only 1,000 users are active, so Hotstar runs its application on just 5 container instances to save cloud hosting costs.
Suddenly, the match starts and 1 crore (10 million) fans log in simultaneously to stream the game. The 5 containers immediately get overloaded and will crash. Hotstar engineers don't have time to manually buy new servers or start containers one by one.
The Kubernetes Solution: Kubernetes detects that container CPU usage is spiking past 80%. It automatically spins up 5,000 new streaming container replicas across dozens of cloud servers in seconds. Once the match finishes and fans log off, Kubernetes automatically scales down and deletes the extra containers to save money. That is K8s automation!
The Core Vocabulary of Kubernetes
Kubernetes uses specific names for its parts. Let's break down the core hierarchy from the smallest unit to the largest system:
Pod
The smallest deployable unit in K8s. A Pod is a wrapper (like a peanut shell) that holds your running Docker container (the peanut).
Node
A single worker computer or virtual machine (like an AWS EC2 instance) that physically hosts and runs the Pods.
Cluster
The brain. A collection of multiple Nodes controlled by a master control plane working together as a single supercomputer.
Deployment
The manager. You tell the deployment: "Keep 3 copies of my app running." If a server dies, the deployment immediately spawns a replacement.
7 Everyday kubectl Commands Every Engineer Needs
To control Kubernetes, you use a CLI tool called kubectl (pronounced "cube control"). Here is the cheat sheet of the 7 commands you will use daily:
| Purpose | kubectl Command | Real-World Analogy & Example |
|---|---|---|
| List Running Pods | kubectl get pods |
Lists all active app containers and shows if they are healthy or crashing.
Example:
kubectl get pods (Shows names, status, and restarts). |
| List Server Nodes | kubectl get nodes |
Lists all the physical/virtual computer servers linked to the cluster.
Example:
kubectl get nodes |
| Deploy/Modify Apps | kubectl apply -f <file.yaml> |
Feeds a YAML configuration blueprint to the cluster to create or update resources.
Example:
kubectl apply -f deployment.yaml |
| Delete Resources | kubectl delete -f <file.yaml> |
Deletes deployed resources described in the YAML file from the cluster.
Example:
kubectl delete -f deployment.yaml |
| View Application Logs | kubectl logs <pod-name> |
Displays stdout logs from your app container to debug errors or warnings.
Example:
kubectl logs my-web-pod-a1b2 |
| Describe Resource Details | kubectl describe pod <pod-name> |
Prints detailed metadata, events, and configuration errors for troubleshooting.
Example:
kubectl describe pod my-web-pod-a1b2 |
| Scale Manually | kubectl scale --replicas=<N> deploy/<name> |
Tells K8s to immediately spin up or scale down your app to exactly N copies.
Example:
kubectl scale --replicas=10 deployment/my-api |
Pro-Tip: Pod Self-Healing
In Kubernetes, never restart a pod manually! If you delete a crashing pod using kubectl delete pod <name>, the supervising Deployment will instantly spawn a brand new pod with a fresh IP address to replace it. K8s is self-healing!
Next Steps on Your DevOps Journey
Now that you can run containerized clusters at scale using Kubernetes, you run into another DevOps roadblock: How do we write down all these server networks, K8s clusters, and databases as reusable code blueprints rather than clicking buttons on cloud dashboards? Enter Terraform (Infrastructure as Code)!