Kubernetes How It works
- Sharon Rajendra Manmothe

- 2 days ago
- 2 min read
We run Docker, then we go to Kubernetes and turn on cluster in Docker — what exactly are we doing? Is it related to architecture?

Try to Understand this
Your App
↓
Docker Image
↓
Container Runtime (Docker / containerd)
↓
Kubernetes
↓
Cluster (Control Plane + Worker Nodes)
↓
Pods (running your containers)

Architecture of Kubernetes
When you enable Kubernetes in Docker Desktop:
Your laptop becomes BOTH master and worker.

When you enable Kubernetes:
You are moving from:
Single container management (Docker only)
To:
Cluster-based container orchestration (Kubernetes)Docker Only | Docker + Kubernetes |
Run 1 container | Run many containers |
Manual restart | Auto restart |
No auto scaling | Auto scaling |
No self-healing | Self-healing |
Local only | Cluster architecture |
Docker builds the image
Kubernetes runs and manages containers from that image
When we run with Docker,
docker build -t flask-app .docker run flask-appThat is simple container execution.
But in Kubernetes:
You create:
Deployment YAML
Service YAML
Then:
kubectl apply -f deployment.yamlapiVersion: apps/v1
kind: Deployment
metadata:
name: flask-deployment
spec:
replicas: 3
selector:
matchLabels:
app: flask-app
template:
metadata:
labels:
app: flask-app
spec:
containers:
- name: flask-container
image: flask-app:latest
ports:
- containerPort: 5000
What happens internally?
API Server receives YAML
Scheduler selects node
3 Pods are created
Each Pod runs container from image
kubelet starts container
Why we Use Serverice. Yaml
Pod-1 → 10.244.0.5
Pod-2 → 10.244.0.6
Pod-3 → 10.244.0.7
What Happens If Pod Crashes?
Imagine you have:
Replica = 1
Pod IP = 10.244.0.5
Now:
Pod crashes ❌
Kubernetes deletes it
Kubernetes creates a NEW Pod
Now new Pod might get:
Pod IP = 10.244.0.9
Old IP (10.244.0.5) is gone.
That is what we mean by:
Pods have dynamic IPs.

like we did here ,
apiVersion: v1
kind: Service
metadata:
name: flask-service
spec:
type: NodePort
selector:
app: flask-app
ports:
- protocol: TCP
port: 80
targetPort: 5000
nodePort: 30007

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.

$50
Product Title
Product Details goes here with the simple product description and more information can be seen by clicking the see more button. Product Details goes here with the simple product description and more information can be seen by clicking the see more button.


Comments