,

From Docker to Kubernetes: A Beginner’s Journey

Posted by


🚢 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.


Leave a Reply

Your email address will not be published. Required fields are marked *

0
Would love your thoughts, please comment.x
()
x