A cloud-based deployment and scaling for ML services using Docker, Kubernetes, serverless functions, CI/CD pipelines and cloud data storage – built as part of my other project to save some time.
This repo contains a fully production-ready solution that demonstrates the deployment, orchestration and scaling of ML/data processing pipelines in the cloud. It includes:
- Flask API service with RESTful API exposing endpoints for training, inference and health checks
- ML pipeline: model training using scikit-learn and XGBoost with hyperparameter tuning and cross-validation
- Docker containerization
- Kubernetes orchestration: YAML manifests for deploying and exposing the service on a Kubernetes cluster
- Serverless integration: an AWS Lambda function for on-demand predictions
- CI/CD pipeline with a GitHub Actions workflow that automates linting, testing, building and deployment
- Cloud storage integration: sample code to interface with AWS S3 for data storage and logging
- Various utilities: logging, error handling and configuration management
- Python 3.9+
- Docker
- Kubernetes (kubectl configured to your cluster)
- AWS CLI configured (for Lambda & S3 access)
- Serverless Framework (if deploying Lambda functions)
- Clone the repository:
git clone https://github.com/avrtt/CloudML-Orchestrator.git cd CloudML-Orchestrator
- Install Python dependencies:
pip install -r requirements.txt
- Set environment variables:
Create a.env
file or export required variables (seeapp/config.py
for details).
Run the Flask API service:
python -m app.app
The service will be available at http://localhost:5000.
Build the Docker image:
docker build -t cloudml-orchestrator .
Run the container:
docker run -p 5000:5000 cloudml-orchestrator
Deploy to Kubernetes:
./deploy.sh --k8s
Deploy the Lambda function using Serverless Framework:
cd cloud
sls deploy
This repository includes a GitHub Actions workflow (see .github/workflows/ci-cd.yml
) that runs tests, builds the Docker image and (if configured) deploys to your cloud environment.
Don't forget to specify you Docker repo instead of
your-docker-repo
.
- app/ contains the Flask API and ML pipeline code
- cloud/ contains AWS Lambda function code and Serverless configuration
- k8s/: kubernetes deployment and service manifests
- tests/: unit tests for the Flask API
- .github/workflows/: GitHub Actions CI/CD configuration
Feel free to open issues.
MIT