Giter Site home page Giter Site logo

wbuchwalter / kubernetes-webhook-autoscaler Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 3.0 665 KB

An autoscaler that call user-specified webhooks when conditions for scale in/out are detected in a Kubernetes cluster.

License: Other

Python 96.86% Shell 0.21% Smarty 2.20% Makefile 0.73%

kubernetes-webhook-autoscaler's Introduction

Kubernetes-webhook-autoscaler

Kubernetes autoscaler using webhooks.

This works in two pieces :

  • The Kubernetes autoscaler part is interacting with the API of the cluster and sending webhooks
  • The 'client' part is receiving the hooks and triggering the scaling. You can find example of this part inside the examples folder.

Full List of Options

$ python main.py [options]
Option Description Default
--kubeconfig Path to kubeconfig YAML file. Leave blank if running in Kubernetes to use service account
--scale-out-webhook URI to be called when a scaling out need is detected by the autoscaler
--scale-in-webhook URI to be called when a scaling in need is detected by the autoscaler
--pool-name-regex Regex used to identify agents in the pool(s), the regex should not match masters. kubectl get nodes to find your worker node names agent
--drain Wether the autoscaler should drain and cordon nodes before passing them to the scale-in webhook
--sleep Time (in seconds) to sleep between scaling loops 60
-v Sets the verbosity. Specify multiple times for more log output, e.g. -vvv
--debug Do not catch errors. Explicitly crash instead
--ignore-pools Names of the pools that the autoscaler should ignore, separated by a comma
--spare-agents Number of agent per pool that should always stay up 1
--idle-threshold Maximum duration (in seconds) an agent can stay idle before being deleted
--over-provision Number of extra agents to create when scaling up 0

Payload

Scale In

[
    {
        name: "pool1",
        target_nodes: ["node1", "node2"],
        current_agent_count: 5,
        desired_agent_count: 3
    }
]

Scale Out

[
    {
        name: "pool1",
        current_agent_count: 3,
        desired_agent_count: 5
    }
]

Deploy it in a K8s cluster using Helm

helm install helm-chart --name k8s-wh-as \
    --set options.scaleoutwebhook=<SCALE-OUT-URL>,options.scaleinwebhook=<SCALE-IN-URL>,options.poolnameregex=<REGEX-NODES-TO-WATCH>

Running locally

$ make build-run
#in the container
$ python main.py [arguments]

kubernetes-webhook-autoscaler's People

Contributors

wbuchwalter avatar julienstroheker avatar vicki-c avatar ritazh avatar jimzim avatar catherio avatar jonasschneider avatar kim0 avatar aykamko avatar esigler avatar mistobaan avatar kkaneda avatar nottombrown avatar adam-sandor avatar

Stargazers

 avatar Jesper Petersen avatar marion avatar Toni Röyhy avatar Mark deVilliers avatar Rimantas (Rimas) Mocevicius avatar  avatar  avatar Sertaç Özercan avatar

Watchers

 avatar James Cloos 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.