/CloudML-orchestrator

A cloud-based deployment and scaling for ML services (Docker, k8s, AWS S3/Lambda, Flask, GitHub Actions)

Primary LanguagePythonMIT LicenseMIT

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

Prerequisites

  • Python 3.9+
  • Docker
  • Kubernetes (kubectl configured to your cluster)
  • AWS CLI configured (for Lambda & S3 access)
  • Serverless Framework (if deploying Lambda functions)

Installation & usage

  1. Clone the repository:
    git clone https://github.com/avrtt/CloudML-Orchestrator.git
    cd CloudML-Orchestrator
  2. Install Python dependencies:
    pip install -r requirements.txt
  3. Set environment variables:
    Create a .env file or export required variables (see app/config.py for details).

Running locally

Run the Flask API service:

python -m app.app

The service will be available at http://localhost:5000.

Docker

Build the Docker image:

docker build -t cloudml-orchestrator .

Run the container:

docker run -p 5000:5000 cloudml-orchestrator

Kubernetes

Deploy to Kubernetes:

./deploy.sh --k8s

AWS Lambda (serverless)

Deploy the Lambda function using Serverless Framework:

cd cloud
sls deploy

CI/CD

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.

Project structure

  • 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

Contributing

Feel free to open issues.

License

MIT