Originally published on CodingCush.
Kubernetes is an open source system that runs and manages your containers for you. You tell it what your app should look like, three copies of your website running at all times, and it makes that happen and keeps it happening. Its short name is K8s. It does not replace Docker: Docker, or another container runtime, still runs each container, while Kubernetes decides where containers run, how many run, and what happens when one fails.
Why Do Containers Need a Manager at All?
One container is easy. You start it, it runs your app, and you can watch it yourself. Fifty containers is a different job. Which machine is each one on, and what happens when one crashes at 3 in the morning?
Doing that by hand is slow and full of mistakes, and that is the problem Kubernetes solves. Think of a school orchestra: fifty musicians need a conductor who keeps everyone in time. Kubernetes is that conductor. You describe the result you want, called the desired state, and it keeps checking reality against it. If a container dies, it starts a replacement. The Kubernetes concepts overview page says the same thing: you manage containerized workloads through declarative configuration and automation.
What Is a Pod, a Node, and a Cluster?
These three words show up in every Kubernetes conversation. Picture a shipping company: a pod is a sealed box, a node is a ship, and a cluster is the whole fleet.
A pod is the smallest thing Kubernetes runs, usually one container, your app, plus sometimes a small helper, for example one that collects logs. Containers in one pod always run on the same node and share an IP address. You almost never create a pod directly: you ask for a Deployment, and it creates pods for you. A node is a machine, real or virtual, that runs your pods. A small cluster can have one node, and a large one can have thousands. Your laptop can be a one-node cluster while you learn. A cluster is the full set: all the nodes plus the control plane, the brain that holds the desired state and schedules pods onto nodes.
The kubernetes.io homepage.
Is Kubernetes a Replacement for Docker?
No. Docker builds and runs containers, while Kubernetes tells containers where to run and keeps them running. They are partners, not rivals.
| Question | Docker | Kubernetes |
|---|---|---|
| What does it do? | Runs one container on one machine | Manages many containers on many machines |
| What do you give it? | An image and a run command | A YAML file with the desired state |
| If a container crashes? | It stops, unless you set a restart rule | Kubernetes starts a replacement automatically |
| Scaling up? | You start more containers by hand | Change one number |
| How do users reach it? | You map a port yourself | A Service gives a stable address |
| Best for? | One app on one machine | Apps on many machines |
If the container side still feels fuzzy, read our guide to the difference between a Docker image and a container. Kubernetes assumes you already know that part.
What Does a Real Kubernetes Setup Look Like?
Here is the official Deployment example from the Kubernetes docs. Save it as nginx-deployment.yaml.
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 apiVersion and kind say this file describes a Deployment, using the apps/v1 API. spec.replicas: 3 says you want three copies running. The selector matches pods by the label app: nginx. The template is the recipe for each pod: one container named nginx, running the nginx:1.14.2 image on port 80. The label in the template must match the selector exactly, or Kubernetes will not know which pods it owns.
Apply it with kubectl, the command line tool for talking to a cluster:
kubectl apply -f nginx-deployment.yaml kubectl get deployments kubectl get pods Once the rollout finishes, the Deployment output should look like this, with READY 3/3 meaning all three copies are running:
NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 18s Pod names carry a random suffix, so never script against an exact pod name.
Want five copies instead of three? Change one number:
kubectl scale --replicas=5 deployment/nginx-deployment Kubernetes creates the two extra pods on nodes with free room. Change the number back to 3 and it removes two. That one command is the whole idea of Kubernetes in miniature: you change the desired state, and the system does the work.
What Do Deployments and Services Actually Do?
A Deployment is the manager of your pods. It keeps the right number of copies running, replaces crashed ones, and rolls out updates gradually. When you change the image, it swaps pods one at a time: it creates a new pod, waits until it is healthy, then stops an old one. If the new version is broken, roll back with kubectl rollout undo deployment/nginx-deployment.
A Service is the stable front door. Pods come and go, and each pod IP changes when the pod is replaced, so you cannot give users a pod IP. A Service gets a fixed address and forwards traffic to whichever pods are healthy right now, matching them by label. The usual pattern is one Deployment plus one Service per app. Create one with kubectl expose deployment nginx-deployment --type=LoadBalancer --port=80.
Kubernetes does not build your app or deploy your source code: that job belongs to a CI/CD pipeline, which builds the image and hands the new version to Kubernetes.
Do I Need Kubernetes for My Small Project?
Probably not yet, and that is fine. If your project is one website on one server, Kubernetes adds learning, moving parts, and things that can break, without giving you much back. One container on one machine is a Docker job, and a few containers on one machine, for example an app plus a database, is a Docker Compose job, with a much shorter file and far less to learn.
Kubernetes earns its keep when you have several services that must stay up, traffic that rises and falls, or more than one machine. A good rule: if restarts, scaling, and updates by hand are eating your time, you have a Kubernetes-shaped problem. If not, learn it on the side with Minikube, so it is ready when you need it.
Is Kubernetes Hard to Learn? Where Do I Start?
Yes, it has a real learning curve, but the first step is smaller than people think. The hard part is the new mental model: desired state, labels, and controllers doing work for you. Start on your own laptop with Minikube, which runs a single-node cluster for learning. The Kubernetes documentation home page points beginners to the Hello Minikube tutorial, and its first steps are short:
minikube start minikube status kubectl get nodes minikube start creates the cluster. minikube status should show the host, kubelet, and API server as Running, and kubeconfig as Configured. kubectl get nodes should list your one node as Ready. From there, apply the nginx Deployment above, scale it, expose it, and delete it with kubectl delete deployment nginx-deployment when you are done.
What Goes Wrong When Beginners Start With Kubernetes?
Most first-week errors fall into a small set. ImagePullBackOff means Kubernetes could not download your image: check the image name and tag for typos, and that the image really exists. A private image needs credentials. CrashLoopBackOff means your container starts, crashes, and Kubernetes keeps retrying it: read the logs first with kubectl logs, followed by the pod name from kubectl get pods. The logs usually name the real problem, such as a missing environment variable.
Next, a selector mismatch: the Deployment selector and the pod template labels disagree, so no pods are managed. Compare the two label blocks character by character. Then there is editing a pod directly to fix something. Do not. The Deployment will replace your edited pod with a fresh copy from the template, and your fix will vanish. Change the Deployment instead. Last, forgetting the Service: pods are only reachable inside the cluster by default. If your app works inside the cluster but not from your browser, check kubectl get services first.
What Should I Try First?
Install Minikube and kubectl, run minikube start, and apply the nginx Deployment from this post. Watch it reach 3/3 ready, scale it to 5, then back to 1, and delete it. Then deploy something of your own and expose it with a Service. That afternoon teaches you pods, Deployments, Services, and scaling by doing.
Kubernetes is not magic, and it is not a replacement for Docker. It is a patient manager for containers: you describe the result you want, and it keeps your app at that result while you get on with building the app itself. Learn it on one small cluster, and the big ideas will be in place when your project grows up.



