Posts

Showing posts from January, 2026

“Kubernetes Fundamentals Explained — What, Why, and When for Every Core Component”

 Pods → run Service → expose Ingress → route Storage → save data Config → settings Helm → manage apps Monitoring → observe EKS → production Let’s slow it down and explain WHY each piece exists + WHAT problem it solves + WHEN we use it — like real-world thinking, not textbook style. Think of Kubernetes like building a house ๐Ÿ  Each object has a job. ๐Ÿงฑ 1️⃣ Pods → run ๐Ÿง  What? Smallest unit that runs containers. Why? Containers cannot run directly in Kubernetes. They must live inside a Pod. ๐Ÿ‘‰ Pod = wrapper for container Real-world use Run your app: nginx nodejs python app API Problem it solves Without Pod → no workload runs Example kubectl run nginx --image=nginx ๐Ÿ‘‰ Now app is running Easy memory Pod = process ๐ŸŒ 2️⃣ Services → expose ๐Ÿง  What? Gives network access to Pods. Why? Pods have: ❌ random IPs ❌ change when recreated So you can’t connect reliably. Service gives: ✅ stable IP ✅ stable DNS name Real-world use Expose: ...
  ๐ŸŒฉ️ Lab Environment on Amazon Web Services using Amazon EC2 CPU   → 2–4 cores RAM   → 4–6 GB Disk  → 30–40 GB Create: Ubuntu 22.04 t2.medium SSH login ssh ubuntu@<ip> ๐Ÿ”น STEP 1 — Install Docker ✅ Why? Minikube runs Kubernetes inside Docker containers sudo apt update sudo apt install docker.io -y sudo systemctl enable docker sudo systemctl start docker sudo usermod -aG docker $USER newgrp docker Check: docker ps ๐Ÿ‘‰ works = good ๐Ÿ”น STEP 2 — Install kubectl ✅ Why? kubectl = control Kubernetes cluster sudo snap install kubectl --classic kubectl version --client ๐Ÿ”น STEP 3 — Install Minikube ๐Ÿค” Why Minikube is necessary? Before Minikube: ❌ need 3–5 servers ❌ costly ❌ complex With Minikube: ✅ single node cluster ✅ local testing ✅ fast learning ✅ safe experiments ๐Ÿ‘‰ Think: Minikube = practice ground EKS/Prod = real battlefield Install: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 chmod +x minikube-linux-am...
  ๐Ÿš€ Kubernetes Setup (Local) ๐ŸŸข Minikube Start cluster minikube start Check kubectl get nodes kubectl cluster-info ๐Ÿ“ฆ POD ✅ What is Pod? Smallest deployable unit in Kubernetes Contains: 1 or more containers same network same storage ✅ Why Pod? Because containers cannot run directly , they must run inside Pods. ๐Ÿ”น Pod Commands kubectl get pods kubectl describe pod mypod kubectl logs mypod kubectl delete pod mypod kubectl exec -it mypod -- bash ๐Ÿ”น Create Pod (quick) kubectl run nginx --image=nginx --restart=Never ๐Ÿ”น Pod YAML apiVersion: v1 kind: Pod metadata: name: nginx-pod spec: containers: - name: nginx image: nginx ports: - containerPort: 80 ๐Ÿ”น Generate YAML automatically kubectl run nginx --image=nginx --dry-run=client -o yaml > pod.yaml ๐Ÿ” REPLICASET ✅ What is ReplicaSet? Ensures fixed number of pods always running ✅ Why? If pod dies → auto recreate ๐Ÿ”น Commands kubectl get rs kubectl scale rs myrs --replicas=5 kubectl delete rs myrs ๐Ÿ”น R...

K8s Workloads: Mandatory Fields, YAML Templates & Commands

  ✅  Mandatory Fields Table (VERY IMPORTANT ⭐) Resource Mandatory fields Pod apiVersion, kind, metadata.name, spec.containers[].name, image ReplicaSet apiVersion, kind, metadata.name, spec.selector, spec.template, containers Deployment apiVersion, kind, metadata.name, spec.selector, spec.template, containers ✅ Side-by-Side Comparison (Pod vs RS vs Deployment) Feature Pod ReplicaSet Deployment Purpose Single container Maintain replicas Manage RS + rolling updates Replicas ❌ ✅ ✅ Self-healing ❌ ✅ ✅ Rolling update ❌ ❌ ✅ Rollback ❌ ❌ ✅ Used in real projects Rare Rare ⭐ Mostly used YAML complexity Simple Medium Medium Creates Containers Pods RS + Pods ๐Ÿ”ฅ  Memory Tricks (exam hacks) ๐Ÿง  Structure memory Pod → containers RS → replicas + selector + template Deployment → same as RS + rollout features ๐Ÿง  Labels rule (most common mistake) selector.matchLabels MUST match template .labels ๐Ÿง  apiVersion memory Pod → v1 RS → apps/v1 Deployment → apps/v1 ๐Ÿš€ Bonus: Gene...