🚀 Deploying NGINX on Minikube with Rolling Updates — A Hands-on DevOps Project

 By Raees Qazi | DevOps Engineer | Learner | Mentor | Creator

In today’s hands-on session, we’ll deploy an NGINX server using Minikube and understand how Kubernetes Deployments help maintain the desired state of our Pods. We’ll also perform a Rolling Update to upgrade the NGINX version without any downtime.

Press enter or click to view image in full size

📂 Project Hierarchy:

Minikube → Namespace → Deployment/Pods → Service → Rolling Update

📎 Project GitHub Repository:
👉 https://github.com/LondheShubham153/aws-eks-devops-best-practices

Just clone it, follow along, and practice!

🧠 Before We Start — Some Key Concepts

1. 🔁 Reverse Proxy

reverse proxy sits in front of your web servers and handles client requests. Instead of showing an error when a backend server fails, a reverse proxy can display a friendly message or redirect traffic elsewhere.

Example:
When you visit an Instagram profile that doesn’t exist, you see: “Sorry, this page isn’t available.”
That’s a reverse proxy handling your request gracefully.

2. 📦 ReplicaSet vs Deployment

Both ReplicaSet and Deployment manage Pods, but:

  • ReplicaSet: Maintains the number of Pods but doesn’t support rolling updates.
  • Deployment: Provides all ReplicaSet features plus the ability to do rolling updates — a powerful way to update applications with zero downtime.

Rolling Update Workflow:
If you have 3 running Pods and update the Deployment, Kubernetes will replace them one-by-one, ensuring your app remains available throughout the update.

🔧 Let’s Start the Project Step-by-Step

1️⃣ Create Project Directory and Clone Repo

mkdir k8s-practice
cd k8s-practice
git clone https://github.com/LondheShubham153/aws-eks-devops-best-practices
cd aws-eks-devops-best-practices/01-deplyment

2️⃣ Create Namespace and Deploy NGINX

kubectl create namespace eks-sample-app
kubectl apply -f 01-deployment.yaml
kubectl get pods -n eks-sample-app

3️⃣ Configure the Service

First, open the service file:

vim 02-service.yaml

Change this line:

type: LoadBalancer

to:

type: ClusterIP

This is ideal when running a single-node cluster like Minikube.
On Minikube, use NodePort.
On AWS/cloud, you’d typically use LoadBalancer for exposing services to external traffic.

Apply the service:

kubectl apply -f 02-service.yaml
kubectl get all -n eks-sample-app

4️⃣ Access the App via Minikube

minikube ssh             # Enter Minikube shell
docker ps # List running containers inside Minikube
kubectl get svc -n eks-sample-app
minikube service --url eks-sample-service -n eks-sample-app

To expose it manually via port-forwarding:

kubectl port-forward svc/eks-sample-service -n eks-sample-app 8081:80 --address 0.0.0.0 &
  • 8081: Your host port
  • 80: Service port
  • 0.0.0.0: Makes it publicly accessible
  • &: Runs in the background

🛡️ On AWS, update the Security Group to allow port 8081 from Anywhere (0.0.0.0/0).
Then open: http://<your-host-ip>:8081 — You’ll see the NGINX welcome page! ✅

🔄 Perform a Rolling Update — Upgrade NGINX

Currently, NGINX is running with version 1.22. Let’s upgrade it to 1.23.

Check existing Deployment:

kubectl get deployment -n eks-sample-app
kubectl describe deployment eks-sample-deplyment -n eks-sample-app

Monitor live pod changes:

watch kubectl get pods -n eks-sample-app

Apply the updated Deployment:

kubectl apply -f 03-deployment.yaml

Watch how pods are replaced one at a time — this is rolling update in action.

Re-expose the service if needed:

kubectl port-forward svc/eks-sample-service -n eks-sample-app 8081:80 --address 0.0.0.0 &

(Optional) Set the namespace as default to avoid typing -n eks-sample-app every time:

kubectl config set-context --current --namespace=eks-sample-app

✅ Summary

In this project, we:

  • Deployed NGINX on Minikube
  • Created Namespaces, Deployments, and Services
  • Performed a Rolling Update from NGINX 1.22 to 1.23
  • Practiced real-world Kubernetes concepts hands-on

If you found this helpful, please share it, and most importantly — practice it.
You’ll understand Kubernetes much better by actually doing it.

Happy Learning! 🚀
— Raees Qazi

Comments

Popular posts from this blog

📘 Understanding Prometheus in a Simple Way-Part 3 (For DevOps Beginners)

Grafana Setup & Dashboard Creation (Part-5)— Explained by Raees Yaqoob Qazi

My First Python Program: A Simple Calculator