This beginner-friendly project walks you through building and deploying a machine learning model for diabetes prediction. You’ll learn how to:
- ✅ Train a model using Random Forest
- ✅ Serve it with FastAPI
- ✅ Dockerize the application
- ✅ Deploy it on Kubernetes (with Kind)
- ✅ Understand CI/CD and monitoring steps for future improvements
Predict if a person is diabetic based on:
- Pregnancies
- Glucose
- Blood Pressure
- BMI
- Age
Model used: Random Forest Classifier
Dataset: Pima Indians Diabetes Dataset
git clone https://github.com/iam-veeramalla/first-mlops-project.git
cd first-mlops-project🔹 Windows (CMD)
python -m venv .mlops
.mlops\Scripts\activate🔹 Windows (PowerShell)
python -m venv .mlops
.\.mlops\Scripts\Activate.ps1🔹 macOS/Linux
python3 -m venv .mlops
source .mlops/bin/activate🔹 Windows with Git Bash
python -m venv .mlops
source .mlops/Scripts/activatepip install -r requirements.txtpython train.py➡️ This will generate a model.pkl file used for predictions.
uvicorn main:app --reloadOpen your browser: http://localhost:8000/docs
{
"Pregnancies": 2,
"Glucose": 130,
"BloodPressure": 70,
"BMI": 28.5,
"Age": 45
}docker build -t diabetes-prediction-model .docker run -p 8000:8000 diabetes-prediction-modeldocker tag <image-id> iamvikramkumar/diabetes-prediction-model:v1(Find <image-id> using docker images)
docker login
docker push iamvikramkumar/diabetes-prediction-model:v1📝 Note: Please install Docker Desktop, Kubectl, and Kind before proceeding.
kind create cluster --name demo-mlopskubectl config current-context
kubectl get nodeskubectl apply -f deploy.yamlkubectl get pods -w
kubectl get svckubectl port-forward svc/diabetes-api-service 1111:80 --address=0.0.0.0🔗 Open: http://localhost:1111/docs
- Auto test and validate model updates
- Build Docker images
- Push to Docker Hub
- Deploy to Kubernetes
- Prometheus + Grafana for API performance
- Evidently AI or WhyLogs for data drift and prediction accuracy
- Alerts for latency or failure spikes
🙌 Credits
Created by ABHISHEK VEERAMALLA
Subscribe for more DevOps + MLOps content on the YouTube Channel - Abhishek.Veeramalla