Giter Site home page Giter Site logo

lulzzz / kubernetes-webhook-autoscaler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wbuchwalter/kubernetes-webhook-autoscaler

0.0 2.0 0.0 665 KB

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

License: Other

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

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

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

Watchers

 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.