
Docker changed the world of software. It let developers package their apps into containers that run anywhere. Suddenly, "it works on my machine" was no longer an excuse.
But Docker solved one problem and created another. What happens when you have hundredsof containers across dozens of servers? What happens when one crashes at 3 AM? What happens when traffic spikes and you need ten more copies of your app instantly?
Manually starting containers and watching for failures is impossible at scale. You need something that can manage thousands of containers automatically — starting them, stopping them, healing them, and scaling them on demand.
That something is Kubernetes.
In this beginner-friendly guide, you will learn what Kubernetes is, why it exists, how it works, and how to use it — no prior experience required.
Kubernetes (often shortened to K8s) is an open source platform for orchestrating containers. It automates the deployment, scaling, and management of containerized applications.
The name comes from Greek, meaning "helmsman" or "pilot." That is exactly what Kubernetes does — it steers the ship, making sure all your containers are running where they should be, when they should be, and in the right number.
Kubernetes was originally developed by Google, based on their internal system called Borg, which managed billions of containers per week. In 2014, Google open-sourced it, and in 2016 donated it to the Cloud Native Computing Foundation (CNCF). Today it is the industry standard for container orchestration.
Imagine an orchestra with 100 musicians. Each one plays a different instrument. Without someone to coordinate them, it would be chaos — everyone playing at once, at different tempos, with no harmony.
Now add a conductor. The conductor does not play any instrument. Instead, they watch every musician, tell them when to start, when to stop, and how loud to play. If one musician faints, the conductor signals a replacement. If the audience grows, the conductor brings in more musicians.
Kubernetes is the conductor. The containers are the musicians. Kubernetes does not run your app itself — it manages the containers that do. It decides where each container runs, how many should be running, and what to do if one fails.
These two are often confused, but they solve different problems and work together.
| Aspect | Docker | Kubernetes |
|---|---|---|
| What It Does | Builds and runs containers | Manages containers at scale |
| Scope | Single machine | Cluster of machines |
| Analogy | Packaging boxes | Warehouse manager |
| Best For | Development, small deployments | Production, scale, high availability |
They are not competitors — they are teammates. You build containers with Docker, and you run them at scale with Kubernetes.
Kubernetes has its own vocabulary. Here are the terms you need to know.
A cluster is the entire Kubernetes system — a group of machines working together. It consists of one or more control plane nodes (which manage the cluster) and multiple worker nodes (which run your applications).
A node is a single machine (physical or virtual) inside the cluster. Each node runs containers assigned to it by Kubernetes.
A pod is the smallest deployable unit in Kubernetes. It usually contains one container, but can hold multiple tightly-coupled containers that share storage and network. Think of a pod as a wrapper around your container.
A deployment manages a set of identical pods. It ensures the right number are always running, handles rolling updates, and enables rollbacks. This is what you use to deploy stateless apps.
A service gives a stable network address to a set of pods. Since pods come and go, a service provides a consistent way to reach them — like a permanent phone number for a group of shifting employees.
ConfigMaps store non-sensitive configuration data. Secretsstore sensitive data like passwords and API keys. Both are mounted into pods at runtime.
A namespace is a virtual partition inside a cluster. You can use namespaces to separate teams, projects, or environments (dev, staging, prod) within the same cluster.
An Ingress exposes HTTP/HTTPS routes from outside the cluster to services inside. It is how you make your app accessible to the internet.
Kubernetes follows a declarative model. Instead of telling it howto do something step by step, you tell it what you want the final state to be.
For example, you say: "I want 3 replicas of this app running." Kubernetes looks at the current state, notices only 2 are running, and starts a third. If one crashes later, it starts another. The desired state is always maintained.
At the heart of Kubernetes is a simple but powerful idea called the control loop:
This loop runs continuously, which is why Kubernetes can self-heal without human intervention.
Let's deploy a simple Nginx application to Kubernetes. If you want to try this locally, install Minikube or Docker Desktop (which includes a built-in Kubernetes cluster).
Create a file called nginx-deployment.yaml:
This file tells Kubernetes: "Run 3 replicas of Nginx, each in its own pod."
You should see 3 pods running. Kubernetes automatically distributed them across the available nodes.
Create another file called nginx-service.yaml:
Apply it:
Now Kubernetes exposes your Nginx app to the outside world. If you are using Minikube, run minikube service nginx-service to open it in your browser.
Want to run 10 replicas instead of 3? One command:
Kubernetes immediately spins up 7 more pods. No downtime, no manual work.
One of the most impressive Kubernetes features is self-healing. Let's see it in action.
kubectl delete pod pod-nameThis works for crashes too. If a pod runs out of memory or the application crashes, Kubernetes restarts it without any human intervention. This is what makes Kubernetes production-grade.
kubectl is the command-line tool for talking to Kubernetes. Here is a complete reference you can bookmark.
| Command | Description |
|---|---|
| kubectl version | Show client and server versions |
| kubectl cluster-info | Show cluster endpoints |
| kubectl get nodes | List all nodes |
| kubectl get namespaces | List all namespaces |
| kubectl config view | Show current configuration |
| Command | Description |
|---|---|
| kubectl get pods | List all pods |
| kubectl get pods -o wide | List pods with more details |
| kubectl describe pod name | Detailed pod info |
| kubectl logs pod-name | View pod logs |
| kubectl logs -f pod-name | Follow logs in real time |
| kubectl exec -it pod-name -- bash | Open a shell inside a pod |
| kubectl delete pod name | Delete a pod |
| Command | Description |
|---|---|
| kubectl get deployments | List all deployments |
| kubectl create deployment name --image=img | Create a deployment from CLI |
| kubectl apply -f file.yaml | Apply a YAML config |
| kubectl scale deployment name --replicas=5 | Scale to 5 pods |
| kubectl set image deployment/name img:v2 | Update container image |
| kubectl rollout status deployment/name | Check rollout progress |
| kubectl rollout undo deployment/name | Rollback to previous version |
| kubectl delete deployment name | Delete a deployment |
| Command | Description |
|---|---|
| kubectl get services | List all services |
| kubectl expose deployment name --port=80 | Expose a deployment |
| kubectl describe service name | Detailed service info |
| kubectl delete service name | Delete a service |
| Command | Description |
|---|---|
| kubectl get configmaps | List configmaps |
| kubectl create configmap name --from-file=file | Create a configmap |
| kubectl get secrets | List secrets |
| kubectl create secret generic name --from-literal=key=value | Create a secret |
| Command | Description |
|---|---|
| kubectl create namespace name | Create a namespace |
| kubectl get pods -n name | List pods in a namespace |
| kubectl config set-context --current --namespace=name | Switch default namespace |
| kubectl delete namespace name | Delete a namespace (and everything in it) |
| Command | Description |
|---|---|
| kubectl get events | Show cluster events |
| kubectl top pods | Show CPU/memory usage of pods |
| kubectl top nodes | Show CPU/memory usage of nodes |
| kubectl port-forward pod-name 8080:80 | Forward local port to a pod |
| kubectl apply -f file.yaml --dry-run=client | Preview what would be applied |
You do not have to manage Kubernetes yourself. Many providers offer managed clusters.
| Name | Provider | Best For |
|---|---|---|
| Minikube | Open source | Local learning |
| Kind | Open source | Local testing with Docker |
| EKS | AWS | Production on AWS |
| GKE | Google Cloud | Best-in-class managed K8s |
| AKS | Azure | Production on Azure |
| DigitalOcean Kubernetes | DigitalOcean | Simple, affordable clusters |
:latest in production.Kubernetes can feel overwhelming at first. There are dozens of concepts and hundreds of commands. But the core idea is simple: tell Kubernetes what you want, and it works to keep it that way. Start with a single deployment on Minikube, then grow from there. Once you understand Pods, Deployments, and Services, everything else falls into place.