Kubernates , also called K8s is an open-source platform for automating the deployment, scaling and management of containerized applications. Kubernates develops by Googlw and now maintained by Cloud Native Computing Foundation( CNCF).
For example :
There are bunch of applications running in containers(Like Docker containers) across many server , we need to
- Start them
- Stop them if they crash
- Move them if a server goes down
- Scale them up / down
- Expose them to the network
- Roll out new versions safely
Kubernates automates all of the fuctions mentioned above.
Key Functions of Kubernates:
|
Function |
What it does |
|
Orchestration |
Automatically runs containers across many servers. |
|
Scheduling |
Decides which server (node) should run each
container. |
|
Scaling |
Adds or removes containers automatically based on load. |
|
Self-healing |
Restarts failed containers, replaces unhealthy ones. |
|
Load Balancing |
Distributes traffic between multiple containers. |
|
Rolling Updates |
Updates applications with zero downtime. |
|
Service Discovery |
Lets containers find and communicate with each other easily. |
Analogy of Kubernates
- containers = Workers who do the job
- Pods = Small teams of workers
- Nodes = Factory floors (servers)
- Control Plane = The manager who tells each worker what to do.
- Service = The reception desk where people come to ask for help(network access)
- Ingress = The gatekeeper who routes incoming visitors to the right service ( Load Balancer).
Real World Example
Example : To run an e-commerce site :
Frontend ( React app)
Backend API
Database
Payment service
Kubernates can :
- run each component in its own Pods
- Automatically restart the API if it creashes.
- Scale frontend pods up during sales.
- Route traffic to the correct service.
- Update the API to a new version with zero downtime.
Why Companies Use Kubernetes
✅ Portability — Works across any cloud or
on-premise.
✅ Reliability — Auto-healing and scaling.
✅ Efficiency — Packs multiple apps
efficiently on shared servers.
✅ DevOps-friendly — Works perfectly with
CI/CD and GitOps tools.
✅ Extensible — Integrates with service meshes, monitoring, and more.
A simple diagram showing how Pods, Services, and Ingress connect would make the explanation much clearer.
Now I would like to explain about Containers which is a basic foundation for Kubernetes
What is a Container ?
A container is a lightweight, portable , and self -contained environment that includes:
a. application code
b. dependencies (libraries , rutime, config , etc) but not a full Operating System.
This means an app in container can be run anywhere( on laptop, server or in the cloud - exactly with the same way).
In summary :
Think
of a container as a box that holds your app
and everything it needs to run, so it doesn’t depend on the
computer it’s running on.
If
you give that box to anyone — they can run it without worrying about setup,
versions, or missing dependencies.
Example :
Let’s say you have a Python web app that needs:
·
Python
3.10
·
Flask
library
·
Linux
dependencies
Without containers, you’d have to install all of that manually wherever you deploy.With containers, you create a Dockerfile like this:
Then
you build an image:
And
run it anywhere:
Result:
How Containers Work (under the hood)
Containers
use features of the Linux kernel like:
- ·
Namespaces → isolate processes (your app runs
in its own space)
- · Control Groups (cgroups) → limit CPU,
memory, etc.
- ·
Union Filesystems → share layers efficiently
So
multiple containers can run on one OS, each thinking it’s running on its own
machine — but they’re really sharing one OS kernel.
Container vs Virtual Machine (VM)
· A Virtual
Machine as a separate house — each one has its own
plumbing, electricity, and kitchen (its own OS).
· A Container as
a room in a shared building — everyone shares the same
foundation (the host OS) but has their own space.
Why Containers Are Popular
✅ Portable — Runs
anywhere.
✅ Fast — Start/stop in
seconds.
✅ Consistent — Same
behavior across environments.
✅ Efficient — Many
containers can share one machine.
✅ Isolated — Each app
runs independently.
Here’s a simple visual diagram to help you see the difference between containers and virtual machines.
Virtual Machines (VMs)
Each
VM includes its own full operating system, which makes them heavy
and slower to start.
💡 Key points:
·
Each
VM has its own OS → uses more memory and CPU.
·
Boot
time: minutes.
·
Heavier,
but strong isolation.
Containers
Containers
share the same OS kernel but run their own isolated apps —
much lighter and faster.
Key
points:
·
All
containers share one OS kernel.
·
Boot
time: seconds.
·
Very
lightweight — hundreds can run on one host.
· Perfect for microservices and Kubernetes.
So — containers are lightweight, fast, and portable, which is why Kubernetes uses them to deploy and manage applications efficiently.
Containers : virtualize the operating system
How Kubernetes Uses Containers
Kubernetes
doesn’t run applications directly —
instead, it manages containers that run your applications.
But it adds automation, scaling, and networking on top.
Step by step:
In kubernetes , unable run a container directly.
Instead , need to wrap one ( or more) containers inside an unit called Pod.
A Pod is the smallest deployable unit in Kubernetes.
·
Each
Pod gets:
- ·Its own IP address
- Shared network and storage
·
Containers
inside the same Pod can talk to each other using localhost.
💡 Think of a Pod as a “mini-computer” inside your cluster that runs one or more containers together.
2. Pods run on
Nodes
A Node is
a machine — physical or virtual — where Kubernetes runs your Pods.
Each
Node has:
·
A Kubelet (an
agent that talks to the Kubernetes control plane)
·
A Container
runtime (like Docker or containerd)
·
A Kube-proxy (handles
networking)
Kubernetes
automatically schedules (assigns) Pods to Nodes based on available resources
(CPU, RAM, etc.).
3. Managing
Pods with Deployments
A Deployment is
a higher-level object that tells Kubernetes:
·
How
many Pods to run
·
What
container image to use
·
How
to update them (rolling updates)
Example
YAML:
Kubernetes
will:
- ·
Run 3
replicas (identical Pods)
- ·
Restart
any Pod if it fails
- ·
Scale
up/down automatically
4. Services
→ Expose Pods
Pods
can appear and disappear (for scaling or recovery), so their IPs keep changing.
To make communication stable, Kubernetes provides a Service.
A Service gives
a fixed name and IP to a group of Pods — acting like a
built-in load balancer.
Example:
You can think of a Service as a “door” to access your application inside the cluster.
5. Ingress → Access from Outside
Finally, to let external users (like from the internet) reach your Service,
you use an Ingress + Ingress Controller (which you
already learned!).
- · Ingress: defines HTTP routing rules.
- Ingress Controller: enforces them using a reverse proxy (like NGINX or Traefik).
Fl
Flow of Traffic
F
Comments
Post a Comment