vahidmohsseni / k8s-manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Container-Task Orchestrator

This software is consist of three main components based on the architecture that is illustrated below.

System Design

Service Manager

The main component is backend-service-manager which has the features listed below.

  • Handling the connection from Executers
  • Cheking the status of the connections
  • Keeping the connections alive
  • Storing an incoming task and its metadata in memory
  • Assigning a task to a free Executer
  • Replyig to requests from API server

API Server

As the name hints, its main feature is to provide an interface for users to interact with Service Manager. Follow this link to find more about the API endpoints.

Executer Node

This piece of software is the part of the node/container/machine on which you want that task to be run. It constantly communicates with Service Manager, sends its status, and waits for a task to be assigned by keeping the socket connection open to the server. By decoupling this component from the Service Manager, we can scale out or in the runners according to the requirements of the load in the system. The time to wait for a runner to be up and running is eliminated by provisioning them before scheduling any tasks. Practically, we can add up as many runners as we need, and a single instance of the Service Manager will handle the load.

Docker images

For convenience, you can start the cloud containers with docker compose:

docker compose up --build -d

Building individual containers

Build and run the API image

cd api
docker build -f Dockerfile -t k8s-manager-api .
docker run -p 5001:5001 --env HOST=0.0.0.0 -d k8s-manager-api

Build and run the service manager image

cd manager
docker build -f Dockerfile -t k8s-manager-service .
docker run -d k8s-manager-service

Manual deployment

To run this system, follow the following instructions in order.

  1. Service Manager
cd manager
python service.py
  1. API Server
cd api
python app.py
  1. Runners
    • It is possible to run multiple instances of this service on a same machine
cd worker
# Run on localhost
python service.py

# Connect to external host
python3 service.py -a <host address> -p <port>

Acknowledgement

This project has received funding from the Key Digital Technologies Joint Undertaking (KDT JU) under grant agreement No 877056. The JU receives support from the European Union’s Horizon 2020 research and innovation programme and Spain, Italy, Austria, Germany, Finland, Switzerland.

FRACTAL Logo

EU Logo KDT Logo

About

License:MIT License


Languages

Language:Python 97.4%Language:Shell 1.5%Language:Dockerfile 1.1%