Code Monkey home page Code Monkey logo

rabbitmkube's Introduction

logo

rabbitmkube is an autoscaler for k8s deployments that need to base their number of replicas on the number of messages contained in a queue.

It is a simpler alternative to exporting custom-metrics to Kubernetes and creating HorizontalPodAutoScalers.

Requirements

You need to have RabbitMQ Manager plugin so that rabbitmkube can fetch RabbitMQ like this.

Step by Step

  1. Create a RoleBinding as shown in the command below:

kubectl create clusterrolebinding rabbitmkube --clusterrole=cluster-admin --serviceaccount=default:default

  1. Use the deployment.yaml file in this repository by changing its environment variable values.

  2. Add rabbitmkube annotations to your deployments as shown in the example below. messages-per-pod refers to the number of messages that a pod can take at once.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: example-deployment
  labels:
    app: example
  annotations:
    rabbitmkube/min-replicas: "0"
    rabbitmkube/max-replicas: "3"
    rabbitmkube/messages-per-pod: "1"
    rabbitmkube/queue-name: test-autoscaler
spec:                       
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
      - name: example
        image: example/example

Done! Every 10 seconds rabbitmkube will look for deployments annotated with rabbitmkube values and add/remove new replicas to it.

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.