Git Product home page Git Product logo

oc-autoscaler's Introduction

An Openshift Autoscaler prototype

This prototype provides very specific autoscaling of services running on openshift, based on various self-defined metrics. We wrote this code during our Semesters-Work. We ended up with a prototype that delivers surprisingly nice results, considering how little time we were to spend. Yet it is still in prototype shape and needs some refactoring, testing and improvements in order to be production-redy. The code is quick n' dirty, functionality is way better than expected. Have fun and be free to contribute if you have some valuable inputs =) !!

Deployment on Openshift

Prerequisites

  • Docker installed

  • Git installed

  • OC cli installed

  • Docker-Hub account

  • Local Openshift installation

  • An Openshift Project to test the autoscaler on.

Use Openshift with the internal Docker-Registry listening on registry.openshift.local -> map this url to the IP of Openshift's internal registry in your /etc/hosts file if necessary)

Setup InfluxDB and configure Grafana

Login Docker Docker-Hub with your account:

docker login hub.docker.com

Pull InfluxDB, tag it and push it to the local Openshift registry:

docker pull tutum/influxdb
docker tag tutum/influxdb registry.openshift.local/{project}/influxdb
docker login registry.openshift.local
docker push registry.openshift.local/{project}/influxdb

Login to Openshift, choose your project and setup an influxdb service:

oc login
oc project {project}
oc new-app {project}/influxdb

Expose the InfluxDB service (Port 8086) in order to be accessible from outside of openshift. We used Grafana to visualize the data in a dashboard.

Connect a Grafana instance to the exposed InfluxDB Service: Alt DataSource

Import the predefined dashboard, which you can find in the root folder, named Grafana-dashboard.json . It looks like this: Alt DataSource

Setup Autoscaler

git clone https://github.com/thomas-siegrist/oc-autoscaler.git
cd oc-autoscaler
docker login registry.openshift.local

Build and deploy all services as Docker images to the Docker registry with the deploy-scripts in the projects folders:

cd ./autoscale-interpreter
./deploy.sh
cd ../autoscale-scaler
./deploy.sh

Create all the services in openshift:

oc new-app {project}/autoscale-interpreter
oc new-app {project}/autoscale-scaler

The Autoscale Interpreter has a Rest-Service and an according Swagger-UI that allows us to configure the Autoscale Interpreter in running state. In order to be accessible, expose the service over autoscale-interpreter.openshift.local

Set the spring Stage of all the services via Environment-Variable to dev:

  • Go to the Openshift console and click Browse / Deployments
  • Click on the service (do this for each service separately)
  • Click on Actions / Edit Yaml
  • Scroll down to the entry called "Protocol TCP"

Insert the following code-snippet right after it:

env:
	-
		name: STAGE
		value: dev 

Test the setup

Open the Grafana UI, produce some load and watch the metrics and pods going up and down.

oc-autoscaler's People

Contributors

mico-micic avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.