1. What is Kubernetes? (K8s)
-
Definition:
Kubernetes (often written as K8s) is an open-source container orchestration platform.
It automates the deployment, scaling, and management of containerized applications. -
Why we need it:
If you run just 1 container, Docker is enough.
But in real projects, we run tens or hundreds of containers across multiple servers.
Problems arise:-
How to restart a failed container automatically?
-
How to scale containers up/down?
-
How to update apps without downtime?
-
How to expose services to the outside world?
Kubernetes solves all of these by acting like a “container manager” for the whole cluster.
-
-
Key features:
-
Container Scheduling → Decides on which node a container should run.
-
Self-healing → Restarts failed containers automatically.
-
Scaling → Increases or decreases the number of containers based on demand.
-
Rolling Updates & Rollbacks → Updates apps without downtime.
-
Service Discovery & Load Balancing → Distributes traffic to the right containers.
-
-
Real-life analogy:
Think of Kubernetes like an airport traffic control system — instead of planes and runways, it manages containers and servers to make sure everything runs safely and efficiently.
2. What is kubectl?
-
Definition:
kubectl(pronounced cube-control or kube-cuddle) is the command-line tool used to interact with a Kubernetes cluster. -
Purpose:
It sends commands (using Kubernetes API) to manage resources such as pods, deployments, and services. -
Common examples:
-
Analogy:
If Kubernetes is a restaurant kitchen,kubectlis the waiter taking orders from customers (you) and passing them to the chef (K8s) to execute.
3. What is Minikube?
-
Definition:
Minikube is a tool that lets you run a single-node Kubernetes cluster locally on your laptop. -
Purpose:
It’s perfect for:-
Learning Kubernetes
-
Testing small workloads
-
Running labs without using cloud services (AWS/GCP/Azure)
-
-
How it works:
-
It creates a virtual machine or container on your system.
-
Installs Kubernetes inside it.
-
Lets you access it with
kubectl.
-
-
Key features:
-
Runs Kubernetes locally in minutes.
-
Has add-ons like Ingress, metrics-server, dashboard.
-
Supports multiple drivers (Docker, Hyper-V, VirtualBox, etc.).
-
-
Analogy:
If Kubernetes in production is a big city, Minikube is a miniature model of that city — great for learning and experiments.
4. How these three fit together
-
Minikube → Creates your local Kubernetes cluster.
-
Kubernetes → The platform running your containers inside that cluster.
-
kubectl → The remote control to interact with Kubernetes.
1. What is a Cluster?
A Kubernetes Cluster is the complete Kubernetes environment.
It contains:
- Nodes
- Pods
- Services
- Deployments
- etc.
For your Minikube setup:
Your Windows PC │ ▼ Minikube │ ▼ Kubernetes Cluster
When you run:
minikube start
Minikube creates a Kubernetes cluster on your computer.
Check it:
kubectl get nodes
You may see:
NAME STATUS ROLES AGE minikube Ready control-plane 2h
Here:
minikube = NODE
And that node is currently part of your:
Kubernetes Cluster
2. What is a Node?
A Node is a machine where Kubernetes runs your workloads.
A node can be:
- Physical server
- Virtual machine
- Cloud VM
- Minikube VM/container
For example, a production cluster might look like:
Kubernetes Cluster │ ├── Node 1 ├── Node 2 └── Node 3
Each Node has resources:
CPU RAM Storage Network
Kubernetes puts Pods onto these Nodes.
3. What is a Pod?
This is the most important concept.
A Pod is the smallest deployable unit in Kubernetes.
Usually, a Pod contains one application container.
For example:
Node │ ├── Pod │ └── Container │ └── .NET Application │ ├── Pod │ └── Container │ └── Node.js Application │ └── Pod └── Container └── Java Application
You can see your Pods with:
kubectl get pods
For example:
NAME READY STATUS my-app-deployment-7d8f9c6b5-x2abc 1/1 Running
That long name represents a Pod.
4. Why doesn't Kubernetes run the container directly?
This is where beginners often get confused.
You might think:
Node ↓ Container
But Kubernetes normally works like:
Node ↓ Pod ↓ Container
The Pod provides a wrapper around one or more containers.
For most applications:
1 Pod = 1 Container
But Kubernetes also supports:
1 Pod = Multiple Containers
For example:
Pod │ ├── Main Application Container │ └── Sidecar Container
These containers share the Pod's network and storage context.
5. Your Application Example
Suppose you have a .NET application:
my-app
You create a Docker image:
my-app:1.0
Kubernetes creates a Pod:
Pod └── Container └── my-app:1.0
That Pod runs on a Node:
Node └── Pod └── Container └── my-app
And that Node belongs to the Cluster:
Cluster └── Node └── Pod └── Container └── my-app
6. Where does Deployment come in?
Now you're probably thinking:
Okay, where does
Deploymentfit?
Deployment is not inside the Pod.
Instead, Deployment manages Pods.
Cluster │ └── Node │ ├── Pod │ └── Container │ └── Pod └── Container Deployment │ └── manages these Pods
For example:
replicas: 3
means:
Deployment │ ├── Pod 1 │ └── Container │ ├── Pod 2 │ └── Container │ └── Pod 3 └── Container
Kubernetes tries to keep 3 Pods running.
7. Why do we need multiple Pods?
Imagine your website gets lots of traffic.
One Pod:
Users │ ▼ Pod
Maybe one Pod can't handle all the traffic.
So:
Users │ ▼ Service │ ├── Pod 1 ├── Pod 2 └── Pod 3
The Service distributes traffic among the Pods.
8. Now understand Service
A Service is basically a stable networking endpoint for your Pods.
Imagine your Pods are:
Pod 1 → IP 10.244.0.5 Pod 2 → IP 10.244.0.6 Pod 3 → IP 10.244.0.7
Pods can be recreated, so their IP addresses can change.
You don't want users connecting directly to Pod IPs.
Instead:
Service my-app-service │ ┌────────┼────────┐ ▼ ▼ ▼ Pod 1 Pod 2 Pod 3
The Service gives you a stable endpoint.
9. Your Current Setup
From your previous command, you have:
my-app-service TYPE: NodePort PORT: 80 NODEPORT: 30007
Your setup is approximately:
Kubernetes Cluster │ ▼ Node minikube │ ┌──────┴──────┐ │ │ Pod Pod │ │ Container Container │ │ My App My App ▲ ▲ │ │ └──────┬──────┘ │ Service my-app-service │ ▼ NodePort 30007 │ ▼ Browser
If your Deployment has only 1 replica, you'll have:
Cluster │ └── Node: minikube │ └── Pod │ └── Container │ └── My Application
10. Very important distinction
Cluster
The entire Kubernetes environment.
Cluster
Node
A machine inside the cluster.
Cluster └── Node
Pod
A Kubernetes unit running on a Node.
Cluster └── Node └── Pod
Container
Where your actual application process runs.
Cluster └── Node └── Pod └── Container
11. Think about Docker
Since you're likely familiar with Docker, this comparison can help.
Docker:
Docker │ └── Container └── Application
Kubernetes:
Kubernetes Cluster │ └── Node │ └── Pod │ └── Container │ └── Application
So Kubernetes doesn't replace Docker's container concept.
It orchestrates containers.
Modern Kubernetes runtimes can use containerd or other CRI-compatible runtimes rather than Docker itself, but the conceptual model of Pods containing containers remains.
12. One Real-World Example
Imagine you run:
Shiva Concept Solution website
You have a .NET application.
Docker
You create:
Docker Image my-website:1.0
Kubernetes
You deploy it:
Cluster │ └── Node │ └── Pod │ └── Container │ └── my-website:1.0
You want 3 copies:
Cluster │ └── Node │ ├── Pod 1 → Website ├── Pod 2 → Website └── Pod 3 → Website
Deployment manages those Pods:
Deployment │ ├── Pod 1 ├── Pod 2 └── Pod 3
Service connects users to them:
Service │ ┌────────┼────────┐ ▼ ▼ ▼ Pod 1 Pod 2 Pod 3
13. The complete picture
This is the diagram I recommend memorizing:
KUBERNETES CLUSTER │ ┌──────────────┴──────────────┐ │ │ NODE 1 NODE 2 │ │ ┌───┴───┐ Pod │ │ │ Pod Pod Container │ │ Container Container │ │ App A App B DEPLOYMENT │ manages Pods │ ┌──────┼──────┐ ▼ ▼ ▼ Pod Pod Pod SERVICE │ connects users │ ┌─────┼─────┐ ▼ ▼ ▼ Pod Pod Pod
The key sentence:
A Cluster contains Nodes, Nodes run Pods, Pods contain Containers, and Deployments manage Pods while Services provide network access to Pods.
Flow:
You → run command in kubectl → sends request to Kubernetes API Server in Minikube → Kubernetes manages your containers.
0) Prereqs (Windows 10/11)
Hardware virtualization ON in BIOS.
Admin PowerShell.
Optional but recommended: WSL2 + Ubuntu (wsl --install in admin PowerShell, reboot).
Install kubectl (one of):
winget install -e --id Kubernetes.kubectl
choco install kubernetes-cli
scoop install kubectl
Verify: kubectl version --client.
Kubernetes
1) Choose ONE local cluster
A) Docker Desktop (simplest)
Install Docker Desktop (Windows).
Open Settings → Kubernetes → Enable Kubernetes → Apply & Restart.
Wait until status shows Running. Docker also ships a kubectl on PATH.
Docker Documentation
Docker
B) Minikube (very popular for learning)
Install Docker Desktop or enable Hyper-V (Win Pro/Enterprise):
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All (reboot).
minikube
Start a cluster (pick a driver):
With Docker driver (works on Win Home via WSL2):
minikube start --driver=docker
With Hyper-V (Win Pro/Enterprise):
minikube start --driver=hyperv
You can set a default driver: minikube config set driver docker (or hyperv).
minikube
+2
minikube
+2
Tip: If you like ultra-light clusters inside WSL2, kind (Kubernetes-in-Docker) is great: choco install kind → kind create cluster (run inside WSL2).
Kind
+1
Verify your cluster (for any option):
kubectl cluster-info
kubectl get nodes
Create First Kubernate Apps:
1) Create folder k8s-lab or anyname
1) create two file deployment.yaml and service.yaml file
code of deployment.yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-deployment
spec:
replicas: 2 # Number of pods
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: nginx:latest # Your app image
ports:
- containerPort: 80
🌍 Real-World Example: "TechForest App"
📂 Project Structure (Windows)
Create a folder (e.g., C:\node-k8s-app) and inside put:
1) package.json
2) server.js
3) Dockerfile
4) Build & Load Docker Image into Minikube (Windows)
Option A: Use Minikube’s image builder (recommended)
In PowerShell (in your project folder):
Option B: Use Docker inside Minikube
Enable Docker daemon inside Minikube:
5) Kubernetes YAML
Save this as node-app.yaml in C:\node-k8s-app\
6) Deploy to Minikube
Run in PowerShell:
7) Access the App
Option A: Open via Minikube
Option B: Port-forward
👉 Visit: http://localhost:8080
8) Test Endpoints
-
http://localhost:8080/ → Hello from Node.js + Express + Kubernetes on Windows!
-
http://localhost:8080/health → { "status": "ok" }
http://localhost:8080/ → Hello from Node.js + Express + Kubernetes on Windows!
http://localhost:8080/health → { "status": "ok" }
1 Comments
If you’re a student, you can apply for an extra 25% discount by verifying your academic email. While this offer may not stack with other deals, it’s ideal if the 68% sale isn’t active. Many Reddit threads mention that the Educative coupon Reddit community shares fresh student tips and hacky referral tricks regularly. Keep an eye there if you're a savvy saver.
ReplyDeletePOST Answer of Questions and ASK to Doubt