This project demonstrates how to build and containerize a Flask app, push the Docker image to Docker Hub, create a Kubernetes Deployment and Service, and deploy the application on a Minikube cluster. You will also learn how to verify your deployment using the Kubernetes Dashboard and test the application’s performance with Postman.
| Kubernetes Dashboard | Flask App UI | Postman Load Test |
|---|---|---|
![]() |
![]() |
![]() |
Below are all commands you need to recreate the project.
minikube start --driver=dockerEnsure Docker Desktop is running.
Create a Dockerfile:
FROM python:3.9
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]Build and tag:
docker build -t addusername/myapp:latest .Login to Docker:
docker loginPush:
docker push addusername/myapp:latestapiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
spec:
replicas: 2
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: flask-app
image: addusername/myapp:latest
imagePullPolicy: Always
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: myapp-service
spec:
selector:
app: myapp
type: NodePort
ports:
- port: 8080
targetPort: 5000
nodePort: 30036Apply:
kubectl apply -f deployment.yamlkubectl get pods
kubectl get servicesGet the Minikube IP:
minikube ipVisit:
http://<minikube-ip>:30036
✅ You should see the Flask app greet you.
Launch dashboard:
minikube dashboard✅ Collection and results are shown in the Postman screenshot above.
.
├── app.py
├── Dockerfile
├── requirements.txt
└── deployment.yaml
✅ Delete old deployments:
kubectl delete deployment myapp
kubectl delete service myapp-service✅ Re-apply YAML:
kubectl apply -f deployment.yaml✅ Restart Minikube:
minikube stop
minikube startFor better documentation, upload your screenshots here and replace URLs:
-
Kubernetes Dashboard https://github.com/Harshitraiii2005/K8-MiniProject/blob/main/assets/Kubernetes%20Dashboard%20-%20Google%20Chrome%207_4_2025%205_27_55%20PM.png
-
Postman Load Test https://github.com/Harshitraiii2005/K8-MiniProject/blob/main/assets/k8-test%20-%20Harshit%20Rai's%20Workspace%207_4_2025%2011_33_57%20PM.png
Built with ❤️ by Harshit Rai


