From Docker to Kubernetes: A Beginner’s Journey


🚢 From Docker to Kubernetes: A Beginner’s Journey

From Packaging Apps to Running Planet-Scale Systems


📦 Chapter 1: Meet Docker — The Shipping Container for Software

Imagine you’re a chef. You’ve prepared a delicious app, but it only works on your stove. Now you want to ship that app to others — Windows, Linux, Mac, or the cloud. What do you do?

You package it in a box that works anywhere.

That’s what Docker does.

✅ What is Docker?

Docker is a containerization platform. It packages an app with:

  • Code
  • Dependencies
  • OS-level libraries

…into a container — a lightweight, portable unit that runs the same anywhere.

🔧 Core Docker Concepts

TermDescription
ImageBlueprint for your container (like a recipe)
ContainerA running instance of the image
DockerfileInstructions to build an image
Docker HubRegistry to store/share images
VolumePersistent storage for containers

🛠️ Chapter 2: Docker in Action — Local to Cloud

🧪 Example Dockerfile:

FROM node:18
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]

Common Docker Commands:

docker build -t my-app .
docker run -p 3000:3000 my-app
docker ps
docker exec -it <container_id> bash

With Docker, developers can:

  • Package apps consistently
  • Test locally
  • Ship across environments with zero config changes

But there’s a catch…


☸️ Chapter 3: The Limitations of Docker Alone

When running 1 or 2 containers, Docker is perfect. But what happens when:

  • You have 100 containers?
  • Some crash and need to restart?
  • Traffic spikes and you need more instances?
  • You want to load balance, roll back, or scale?

That’s when Docker alone isn’t enough.

You need orchestration.


⚙️ Chapter 4: Enter Kubernetes — The Container Orchestrator

Kubernetes (aka K8s) is like a manager of your container fleet. It ensures:

  • Containers run where needed
  • Failed containers restart
  • Apps scale automatically
  • Updates are rolled out without downtime

Kubernetes was created by Google and is now maintained by the CNCF.


🧱 Chapter 5: Kubernetes Core Components

ComponentRole
PodSmallest deployable unit (holds 1+ containers)
DeploymentManages replica sets & rolling updates
ServiceExposes pods internally or externally
NodeMachine (VM or physical) that runs pods
ClusterCollection of nodes
Control PlaneBrain of Kubernetes — schedules, watches, and manages

📝 Chapter 6: From Dockerfile to Kubernetes YAML

You can’t use a Dockerfile directly in K8s. Instead, you define what should run using YAML.

Example: Kubernetes Deployment YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app
        image: my-app:latest
        ports:
        - containerPort: 3000

Deploy with:

kubectl apply -f deployment.yaml
kubectl get pods

📡 Chapter 7: Exposing Your App — Kubernetes Services

A Pod is temporary and gets a dynamic IP. To expose it:

  • Use a Service (ClusterIP, NodePort, LoadBalancer)
  • For routing traffic (e.g. example.com/api), use Ingress

🧠 Chapter 8: Advanced Kubernetes Features

🔁 Autoscaling

  • Automatically scale pods using CPU or custom metrics
kubectl autoscale deployment my-app --cpu-percent=70 --min=1 --max=10

🎯 Rolling Updates & Rollbacks

  • K8s handles app updates without downtime
  • Rollback in seconds if things break

🛡 Security & Config Management

  • Secrets for API keys
  • ConfigMaps for env configs
  • RBAC for user permissions

🔧 Chapter 9: Tools That Complete the Picture

ToolPurpose
HelmKubernetes package manager
ArgoCDGitOps continuous delivery
Prometheus + GrafanaMonitoring and visualization
LensKubernetes IDE
KustomizeOverlays for staging/prod configs

🧪 Chapter 10: Local Kubernetes with Docker

Yes, you can test Kubernetes with Docker:

  • Use Minikube or Kind (K8s in Docker)
  • Or Docker Desktop’s built-in K8s
minikube start
kubectl get nodes

🛳️ Final Recap: From Docker to Kubernetes

ConceptDockerKubernetes
App packaging✔️✔️ (uses Docker)
Orchestration❌✔️
Auto-scaling❌✔️
Self-healing❌✔️
Load balancing❌ (manual)✔️ (via Services)
Multi-node deployment❌✔️
Suitable for prod🚧✔️

🚀 What to Learn Next?

LevelWhat to Learn
BeginnerDocker CLI, Dockerfiles, Images
IntermediateKubernetes Pods, Deployments, Services
AdvancedHelm, GitOps, Autoscaling, Security, Monitoring

🎓 Learning Resources


🧭 Final Thoughts

Docker makes your app portable.
Kubernetes makes your system resilient and scalable.

If Docker is like building a car…

Kubernetes is the factory that runs the car fleet, fixes it, scales it, and routes traffic.

Together, they define the future of cloud-native software.


Related Posts

Kubernetes RBAC cookbook: common roles (dev, SRE, read-only) safely

Kubernetes RBAC is one of those things that feels annoying until the day it saves your cluster from “oops, I deleted prod.” The tricky part isn’t what…

Read More

General Build Pipeline (CI) in Azure DevOps

Let’s walk through a general-purpose Azure DevOps build pipeline template that can be applied to most common application types (web apps, APIs, microservices, etc.) using CI/CD best…

Read More

Kubernetes Certifications in 2025: Which One Should You Choose?

Kubernetes Certifications in 2025: Which One Should You Choose? Kubernetes has become the cornerstone of modern cloud-native application deployment and orchestration. Whether you’re a beginner just diving…

Read More

Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025

🚀 Top 5 Kubernetes Tools That Will Replace Your Bash Scripts in 2025 For years, DevOps engineers and platform teams have relied on Bash scripts to automate…

Read More

Kubernetes Horror Stories (and What We Learned From Them)

☠️ Kubernetes Horror Stories (and What We Learned From Them) Because what doesn’t kill your cluster makes it stronger. Kubernetes is powerful — but with great power…

Read More

Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide)

💸 Why Your Kubernetes Costs Are Out of Control – and How to Fix It (2025 Guide) Kubernetes is powerful — but it isn’t cheap. While it…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x