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,kubectl
is 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.
Flow:
You → run command in kubectl → sends request to Kubernetes API Server in Minikube → Kubernetes manages your containers.
1) Setup — step-by-step (copy/paste, run as admin when needed)
A. Enable WSL2 & install Ubuntu (PowerShell as Administrator)
See Microsoft WSL docs for details. Microsoft Learn+1
After install, open the Ubuntu terminal and run:
B. Install Docker Desktop on Windows (enable WSL integration)
-
Download & install Docker Desktop for Windows, follow installer.
-
In Docker Desktop settings → Resources → WSL Integration → enable integration for your Ubuntu distro.
-
(Optional) In Settings → Kubernetes → Enable Kubernetes if you want Docker Desktop's single-node K8s.
Docs: Docker Desktop + WSL instructions. Docker Documentation+1
After installation, confirm Docker works inside WSL:
C. Install kubectl (use WSL)
Recommended: install kubectl in your WSL distro (Linux binary):
Official kubectl install docs. Kubernetes
D. Install Minikube (in WSL)
Start a cluster using the Docker driver (works well when Docker Desktop WSL integration is enabled):
Minikube docs & drivers reference. minikube+1
Alternative: kind
for CI or reproducible clusters (kind create cluster
). kind.sigs.k8s.io
E. Install Helm (package manager)
Helm docs. helm.sh
2) First hands-on lab — Pods → Deployment → Service (30–40m)
Create two YAML files:
deployment.yaml
service.yaml
Apply and test:
Explain: replicas, selectors, pod template, service types.
3) Ingress (expose app on a hostname) (30–40m)
Enable the NGINX Ingress controller (Minikube):
Create ingress.yaml
:
Point hello.local
to your minikube IP. On Windows edit C:\Windows\System32\drivers\etc\hosts
:
Then access http://hello.local
in the browser. Minikube ingress guide. Kubernetes
4) ConfigMap & Secret (10–15m)
configmap.yaml
Mount or pass as env var in pod spec. For secrets, use kubectl create secret generic
.
5) Persistent storage (20–30m)
For local labs use a simple PVC backed by minikube hostPath storage class.
pvc.yaml
Use in a pod spec (volumeMount) to show data persistence across pod restarts.
6) Autoscaling & metrics (20–30m)
Enable metrics-server in minikube:
Create HPA:
Docs: metrics-server and minikube addons. KubernetesGitHub
7) Rolling updates & rollback (10–15m)
Update the image:
8) Helm + chart demo (20–30m)
Install a chart (nginx example):
Helm docs. helm.sh
9) CI/CD demo idea (30–45m)
Flow:
-
Git push → GitHub Actions builds Docker image (use GitHub-hosted runner or self-hosted in Windows).
-
Push image to Docker Hub / GHCR.
-
Run
kubectl set image
orhelm upgrade
to deploy new image.
(If students use local Docker Desktop, they can docker build
and kubectl set image
directly.)
10) Troubleshooting & useful commands (cheat-sheet)
Common commands:
Comments
Post a Comment
POST Answer of Questions and ASK to Doubt