☸️ Day 19: Kubernetes & Minikube - Hands-On Guide

Learning Kubernetes with Minikube on Windows

Duration: 4 hours | Module: Release Management

💻 Windows + Minikube: All labs use Minikube running on Windows - free local Kubernetes cluster!
🎯 Why Minikube?
  • ✅ Free - No Azure costs
  • ✅ Runs locally on your laptop
  • ✅ Same kubectl commands as AKS
  • ✅ Perfect for learning
  • ✅ Fast setup
⚠️ Prerequisites:
  1. Docker Desktop installed and running on Windows
  2. At least 4GB RAM available
  3. Virtualization enabled in BIOS
  4. Day 18 complete (Docker basics)

Lab 1: Install Minikube and kubectl on Windows 🔧

Objective: Install Kubernetes tools on Windows
Time: 20 minutes

Exercise 1.1: Install kubectl

1 Download kubectl
# Open PowerShell as Administrator # Create directory for kubectl mkdir C:\kubernetes cd C:\kubernetes # Download kubectl for Windows curl.exe -LO "https://dl.k8s.io/release/v1.28.0/bin/windows/amd64/kubectl.exe"
2 Add to PATH
  • Press Windows + R, type sysdm.cpl
  • Advanced → Environment Variables
  • Edit PATH → Add C:\kubernetes
  • Click OK
  • Close and reopen PowerShell
3 Verify kubectl Installation
# Open new PowerShell window kubectl version --client Client Version: v1.28.0 Kustomize Version: v5.0.4

Exercise 1.2: Install Minikube

1 Download Minikube
# Download Minikube installer cd C:\kubernetes curl.exe -LO https://storage.googleapis.com/minikube/releases/latest/minikube-windows-amd64.exe # Rename for easier use Rename-Item minikube-windows-amd64.exe minikube.exe
💡 Alternative: Use Chocolatey package manager:
choco install minikube
2 Verify Minikube Installation
minikube version minikube version: v1.32.0 commit: 8220a6eb95f0a4d75f7f2d7b14cef975f050512d
✅ Checkpoint: kubectl and Minikube installed successfully

Lab 2: Start Minikube Cluster ☸️

Objective: Create local Kubernetes cluster with Minikube
Time: 25 minutes

Exercise 2.1: Start Minikube

1 Ensure Docker Desktop is Running
  • Start Docker Desktop
  • Wait for it to fully start (green icon in system tray)
2 Start Minikube Cluster
# Start Minikube with Docker driver minikube start --driver=docker 😄 minikube v1.32.0 on Microsoft Windows 11 ✨ Using the docker driver based on user configuration 👍 Starting control plane node minikube in cluster minikube 🚜 Pulling base image ... 🔥 Creating docker container (CPUs=2, Memory=4000MB) ... 🐳 Preparing Kubernetes v1.28.3 on Docker 24.0.7 ... 🔎 Verifying Kubernetes components... 🌟 Enabled addons: storage-provisioner, default-storageclass 🏄 Done! kubectl is now configured to use "minikube" cluster
⏱️ Wait Time: First start takes 2-5 minutes (downloading images)
3 Verify Cluster is Running
# Check cluster status minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured # Check kubectl connection kubectl cluster-info Kubernetes control plane is running at https://127.0.0.1:xxxxx CoreDNS is running at https://127.0.0.1:xxxxx/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy # Check nodes kubectl get nodes NAME STATUS ROLES AGE VERSION minikube Ready control-plane 2m v1.28.3
4 Explore Minikube Dashboard (Optional)
# Open Kubernetes dashboard in browser minikube dashboard 🔌 Enabling dashboard ... 🤔 Verifying dashboard health ... 🚀 Launching proxy ... 🤔 Verifying proxy health ... 🎉 Opening http://127.0.0.1:xxxxx/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
💡 Dashboard: Provides web UI to view pods, deployments, services visually
✅ Checkpoint: Minikube cluster running, kubectl connected

Lab 3: Create Kubernetes Deployment Manifests 📄

Objective: Create YAML files for Deployment and Service
Time: 30 minutes

Exercise 3.1: Create Deployment YAML

1 Create k8s Directory
cd $env:USERPROFILE\Desktop mkdir k8s-demo cd k8s-demo
2 Create Deployment Manifest
notepad deployment.yaml

Add complete deployment configuration:

apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 # Run 3 pods selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:latest ports: - containerPort: 80 resources: requests: memory: "128Mi" cpu: "100m" limits: memory: "256Mi" cpu: "200m"

Save and close

💡 Using nginx image: Public image from Docker Hub, no need for ACR for this demo
3 Create Service Manifest
notepad service.yaml

Add service configuration:

apiVersion: v1 kind: Service metadata: name: nginx-service spec: type: NodePort # For Minikube (not LoadBalancer) selector: app: nginx # Routes to pods with this label ports: - protocol: TCP port: 80 targetPort: 80 nodePort: 30080 # Access on port 30080

Save and close

✅ Checkpoint: Kubernetes manifests created

Lab 4: Deploy Application to Minikube 🚀

Objective: Deploy nginx application to Kubernetes
Time: 35 minutes

Exercise 4.1: Deploy with kubectl

1 Apply Deployment
# Deploy application kubectl apply -f deployment.yaml deployment.apps/nginx-deployment created
2 Watch Pods Being Created
# Watch pods in real-time kubectl get pods --watch NAME READY STATUS AGE nginx-deployment-abc123-xyz45 0/1 ContainerCreating 2s nginx-deployment-abc123-xyz46 0/1 ContainerCreating 2s nginx-deployment-abc123-xyz47 0/1 ContainerCreating 2s nginx-deployment-abc123-xyz45 1/1 Running 15s nginx-deployment-abc123-xyz46 1/1 Running 15s nginx-deployment-abc123-xyz47 1/1 Running 15s # Press Ctrl+C to stop watching
3 Check Deployment Status
# View deployment kubectl get deployment nginx-deployment NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 1m # Get detailed info kubectl describe deployment nginx-deployment Name: nginx-deployment Namespace: default CreationTimestamp: Mon, 17 Feb 2026 10:30:00 +0530 Labels: app=nginx Replicas: 3 desired | 3 updated | 3 total | 3 available StrategyType: RollingUpdate ...
4 Apply Service
# Create service kubectl apply -f service.yaml service/nginx-service created # Check service kubectl get service nginx-service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nginx-service NodePort 10.96.123.45 80:30080/TCP 30s
5 Access Application
# Get Minikube IP minikube ip 192.168.49.2 # Access application via Minikube service URL minikube service nginx-service --url http://192.168.49.2:30080 # Open in browser minikube service nginx-service 🎉 Opening service default/nginx-service in default browser... |-----------|---------------|-------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|---------------|-------------|---------------------------| | default | nginx-service | 80 | http://192.168.49.2:30080 | |-----------|---------------|-------------|---------------------------|
✅ You should see nginx welcome page!
✅ Checkpoint: Application running in Kubernetes and accessible

Lab 5: Practice kubectl Commands 🎯

Objective: Master essential kubectl commands
Time: 40 minutes

Exercise 5.1: Viewing Resources

1 List All Resources
# List pods kubectl get pods NAME READY STATUS RESTARTS AGE nginx-deployment-abc123-xyz45 1/1 Running 0 5m nginx-deployment-abc123-xyz46 1/1 Running 0 5m nginx-deployment-abc123-xyz47 1/1 Running 0 5m # List deployments kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 5m # List services kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 443/TCP 10m nginx-service NodePort 10.96.123.45 80:30080/TCP 3m # List everything kubectl get all NAME READY STATUS AGE pod/nginx-deployment-abc123-xyz45 1/1 Running 5m pod/nginx-deployment-abc123-xyz46 1/1 Running 5m pod/nginx-deployment-abc123-xyz47 1/1 Running 5m NAME TYPE CLUSTER-IP PORT(S) AGE service/kubernetes ClusterIP 10.96.0.1 443/TCP 10m service/nginx-service NodePort 10.96.123.45 80:30080/TCP 3m NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/nginx-deployment 3/3 3 3 5m
2 Detailed Information
# Describe specific pod kubectl describe pod nginx-deployment-abc123-xyz45 Name: nginx-deployment-abc123-xyz45 Namespace: default Node: minikube/192.168.49.2 Status: Running IP: 10.244.0.5 Containers: nginx: Image: nginx:latest Port: 80/TCP State: Running Ready: True Events: Normal Scheduled 5m Successfully assigned default/nginx-deployment-abc123-xyz45 Normal Pulling 5m Pulling image "nginx:latest" Normal Pulled 4m Successfully pulled image Normal Created 4m Created container nginx Normal Started 4m Started container nginx # Describe deployment kubectl describe deployment nginx-deployment # Describe service kubectl describe service nginx-service
3 View Pod Logs
# Get logs from first pod kubectl logs nginx-deployment-abc123-xyz45 /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/ 2026/02/17 05:00:01 [notice] 1#1: start worker processes # Follow logs (real-time) kubectl logs -f nginx-deployment-abc123-xyz45 # View logs from all pods with label kubectl logs -l app=nginx --all-containers=true
4 Execute Commands in Pod
# Execute command in pod kubectl exec nginx-deployment-abc123-xyz45 -- ls /usr/share/nginx/html 50x.html index.html # Interactive shell in pod kubectl exec -it nginx-deployment-abc123-xyz45 -- /bin/bash root@nginx-deployment-abc123-xyz45:/# hostname nginx-deployment-abc123-xyz45 exit

Exercise 5.2: Scaling Application

1 Scale Up to 5 Replicas
# Scale deployment kubectl scale deployment nginx-deployment --replicas=5 deployment.apps/nginx-deployment scaled # Watch new pods being created kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz45 1/1 Running 10m nginx-deployment-abc123-xyz46 1/1 Running 10m nginx-deployment-abc123-xyz47 1/1 Running 10m nginx-deployment-abc123-xyz48 0/1 ContainerCreating 5s nginx-deployment-abc123-xyz49 0/1 ContainerCreating 5s # Wait few seconds and check again kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz45 1/1 Running 10m nginx-deployment-abc123-xyz46 1/1 Running 10m nginx-deployment-abc123-xyz47 1/1 Running 10m nginx-deployment-abc123-xyz48 1/1 Running 20s nginx-deployment-abc123-xyz49 1/1 Running 20s
2 Scale Down to 2 Replicas
kubectl scale deployment nginx-deployment --replicas=2 deployment.apps/nginx-deployment scaled kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz45 1/1 Running 11m nginx-deployment-abc123-xyz46 1/1 Running 11m nginx-deployment-abc123-xyz47 1/1 Terminating 11m nginx-deployment-abc123-xyz48 1/1 Terminating 1m nginx-deployment-abc123-xyz49 1/1 Terminating 1m # After few seconds, only 2 remain kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz45 1/1 Running 12m nginx-deployment-abc123-xyz46 1/1 Running 12m

Exercise 5.3: Update Deployment (Rolling Update)

1 Update Image Version
# Update to specific nginx version kubectl set image deployment/nginx-deployment nginx=nginx:1.25-alpine deployment.apps/nginx-deployment image updated # Watch rolling update in progress kubectl rollout status deployment/nginx-deployment Waiting for deployment "nginx-deployment" rollout to finish: 1 out of 2 new replicas have been updated... Waiting for deployment "nginx-deployment" rollout to finish: 1 old replicas are pending termination... deployment "nginx-deployment" successfully rolled out
2 View Rollout History
# Check rollout history kubectl rollout history deployment/nginx-deployment deployment.apps/nginx-deployment REVISION CHANGE-CAUSE 1 2
3 Rollback to Previous Version
# Undo last deployment kubectl rollout undo deployment/nginx-deployment deployment.apps/nginx-deployment rolled back # Verify rollback kubectl describe deployment nginx-deployment | Select-String "Image" Image: nginx:latest

Exercise 5.4: Test Self-Healing

1 Delete a Pod
# Get pod name kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz45 1/1 Running 15m nginx-deployment-abc123-xyz46 1/1 Running 15m # Delete one pod kubectl delete pod nginx-deployment-abc123-xyz45 pod "nginx-deployment-abc123-xyz45" deleted
2 Watch Kubernetes Auto-Heal
# Immediately check pods kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz46 1/1 Running 16m nginx-deployment-abc123-xyz50 0/1 ContainerCreating 2s # Kubernetes automatically created new pod! # Wait few seconds and check again kubectl get pods NAME READY STATUS AGE nginx-deployment-abc123-xyz46 1/1 Running 16m nginx-deployment-abc123-xyz50 1/1 Running 15s
🎉 Self-Healing in Action! Kubernetes maintains desired state (2 replicas) automatically

Exercise 5.5: Additional kubectl Commands

1 Port Forwarding
# Forward local port to pod kubectl port-forward deployment/nginx-deployment 8080:80 Forwarding from 127.0.0.1:8080 -> 80 Forwarding from [::1]:8080 -> 80 # Now access http://localhost:8080 in browser # Press Ctrl+C to stop port forwarding
2 Get YAML of Running Resources
# Get deployment YAML kubectl get deployment nginx-deployment -o yaml # Get pod YAML kubectl get pod nginx-deployment-abc123-xyz46 -o yaml # Get in JSON format kubectl get deployment nginx-deployment -o json
3 Resource Usage
# View resource usage of pods kubectl top pods NAME CPU(cores) MEMORY(bytes) nginx-deployment-abc123-xyz46 1m 3Mi nginx-deployment-abc123-xyz50 1m 3Mi # View node resource usage kubectl top nodes NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% minikube 250m 12% 1024Mi 25%
4 Namespaces
# List all namespaces kubectl get namespaces NAME STATUS AGE default Active 20m kube-node-lease Active 20m kube-public Active 20m kube-system Active 20m # Create new namespace kubectl create namespace dev namespace/dev created # Deploy to specific namespace kubectl apply -f deployment.yaml -n dev # List pods in dev namespace kubectl get pods -n dev
5 Delete Resources
# Delete using file kubectl delete -f deployment.yaml deployment.apps "nginx-deployment" deleted # Delete service kubectl delete -f service.yaml service "nginx-service" deleted # Or delete by name kubectl delete deployment nginx-deployment kubectl delete service nginx-service # Delete everything with label kubectl delete all -l app=nginx
✅ Checkpoint: Mastered essential kubectl commands

Lab 6: Deploy Your Calculator Image 🧮

Objective: Deploy calculator app from Day 18 to Minikube
Time: 30 minutes

Exercise 6.1: Load Local Image to Minikube

1 Point Docker to Minikube
# Configure Docker to use Minikube's Docker daemon minikube docker-env SET DOCKER_TLS_VERIFY=1 SET DOCKER_HOST=tcp://127.0.0.1:xxxxx SET DOCKER_CERT_PATH=C:\Users\YourName\.minikube\certs SET MINIKUBE_ACTIVE_DOCKERD=minikube REM Run this command to configure your shell: REM @FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env --shell cmd') DO @%i # Execute the configuration & minikube -p minikube docker-env --shell powershell | Invoke-Expression
2 Build Calculator Image in Minikube
# Navigate to calculator project cd $env:USERPROFILE\Desktop\testing-demo\calculator # Build JAR if not already built mvn clean package -DskipTests # Build Docker image (now builds inside Minikube) docker build -t calculator:1.0 . Successfully built abc123 Successfully tagged calculator:1.0 # Verify image in Minikube docker images calculator REPOSITORY TAG IMAGE ID CREATED SIZE calculator 1.0 abc123def456 30 seconds ago 220MB
3 Create Calculator Deployment
cd $env:USERPROFILE\Desktop\k8s-demo notepad calculator-deployment.yaml

Add deployment for calculator:

apiVersion: apps/v1 kind: Deployment metadata: name: calculator-deployment spec: replicas: 3 selector: matchLabels: app: calculator template: metadata: labels: app: calculator spec: containers: - name: calculator image: calculator:1.0 imagePullPolicy: Never # Use local image ports: - containerPort: 8080

Save and close

4 Deploy Calculator
kubectl apply -f calculator-deployment.yaml deployment.apps/calculator-deployment created kubectl get pods NAME READY STATUS AGE calculator-deployment-xyz123-abc45 1/1 Running 10s calculator-deployment-xyz123-abc46 1/1 Running 10s calculator-deployment-xyz123-abc47 1/1 Running 10s # Check logs kubectl logs calculator-deployment-xyz123-abc45
✅ Checkpoint: Your calculator image deployed in Kubernetes!

🎯 Lab Summary

What You've Accomplished:

  • ✅ Installed kubectl and Minikube on Windows
  • ✅ Started local Kubernetes cluster
  • ✅ Created Kubernetes manifests (Deployment & Service)
  • ✅ Deployed nginx application
  • ✅ Accessed application via Minikube service
  • ✅ Practiced kubectl commands (get, describe, logs, exec)
  • ✅ Scaled deployments up and down
  • ✅ Performed rolling updates
  • ✅ Tested rollback functionality
  • ✅ Witnessed self-healing (pod recreation)
  • ✅ Deployed custom calculator image

kubectl Commands Mastered:

Command Purpose
kubectl get pods List all pods
kubectl describe pod [name] Detailed pod information
kubectl logs [pod-name] View container logs
kubectl exec -it [pod] -- bash Shell into pod
kubectl scale deployment --replicas=5 Scale pods
kubectl rollout status deployment Check update progress
kubectl rollout undo deployment Rollback to previous version
kubectl delete pod [name] Delete pod (auto-recreated)

🎓 Kubernetes Concepts Demonstrated:

  • ✅ Declarative configuration (YAML manifests)
  • ✅ Desired state management (replicas maintained)
  • ✅ Self-healing (deleted pods recreated)
  • ✅ Rolling updates (zero-downtime updates)
  • ✅ Scaling (manual scale up/down)
  • ✅ Load balancing (service routes to pods)

🔧 Troubleshooting Guide

Issue Solution
Minikube won't start Ensure Docker Desktop is running
Try: minikube delete then minikube start
Check virtualization enabled in BIOS
Pods stuck in "ImagePullBackOff" For local images, use imagePullPolicy: Never
Build image inside Minikube using minikube docker-env
Can't access service Use minikube service nginx-service to get URL
Or use kubectl port-forward
kubectl not found Check PATH includes C:\kubernetes
Restart PowerShell after adding to PATH
Pods stuck in "Pending" Check: kubectl describe pod [name]
May need more resources: minikube start --memory=4096

📝 Minikube Quick Reference

# Cluster Management minikube start # Start cluster minikube stop # Stop cluster minikube delete # Delete cluster minikube status # Check status minikube ip # Get cluster IP # Services minikube service [service-name] # Open service in browser minikube service [service-name] --url # Get service URL minikube service list # List all services # Dashboard minikube dashboard # Open web UI # Docker minikube docker-env # Show Docker env variables & minikube docker-env | Invoke-Expression # Configure PowerShell # Addons minikube addons list # Show available addons minikube addons enable metrics-server # Enable metrics # Logs minikube logs # View Minikube logs

🎉 Day 19 Labs Complete!

You've mastered Kubernetes with Minikube!

Ready for Day 20: Infrastructure as Code

🎓 Skills Acquired:
  • Minikube cluster management
  • kubectl command proficiency
  • Kubernetes deployment creation
  • Service configuration and access
  • Application scaling
  • Rolling updates and rollbacks
  • Self-healing observation
  • Pod troubleshooting
💡 Remember to stop Minikube when done:
minikube stop # Saves resources on your laptop!