Another Autoscaler is a Kubernetes controller that automatically starts, stops, or restarts pods from a deployment at a specified time using a cron annotation.

Overview

Another Autoscaler

Another Autoscaler is a Kubernetes controller that automatically starts, stops, or restarts pods from a deployment at a specified time using a cron syntax.

Another Autoscaler read the annotation of each deployment and performs an increase or decrease in the number of replicas.

Docker image Kubernetes YAML manifests codebeat badge release license

The date and time must be in UTC.

The restart feature execute a rollout restart deployment.

Use cases

  • Cost savings by reducing the number of replicas after working hours or weekends.
  • GPU deployments stop them after working hours (this is my case in my current job).
  • Another Autoscaler is a perfect combination with Cluster Autoscaler.

Install

# Deploy Another Autoscaler into Kubernetes on default namespace
kubectl apply -f https://raw.githubusercontent.com/dignajar/another-autoscaler/master/kubernetes/full.yaml

Annotations

Stop pods at 6pm every day:

another-autoscaler.io/stop-time: "00 18 * * *"

Start pods at 1pm every day:

another-autoscaler.io/start-time: "00 13 * * *"

Start 3 pods at 2:30pm every day:

another-autoscaler.io/start-time: "30 14 * * *"
another-autoscaler.io/start-replicas: "3"

Restart pods at 9:15am every day:

another-autoscaler.io/restart-time: "15 09 * * *"

Restart pods at 2:30am, only on Saturday and Sunday:

another-autoscaler.io/restart-time: "00 02 * * 0,6"

Example: How to start pods at 2pm and stop them at 3pm every day

The following example start 5 replicas in total at 2pm and stop 4 of them at 3pm every day, the deployment start with 0 replicas.

The start-replicas is not incremental, the value is the number of replicas will be setup by Another Autoscaler at the defined time by start-time.

The date and time must be in UTC.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  labels:
    app: nginx
  annotations:
    another-autoscaler.io/start-time: "00 14 * * *"
    another-autoscaler.io/start-replicas: "5"
    another-autoscaler.io/stop-time: "00 15 * * *"
    another-autoscaler.io/stop-replicas: "1"
spec:
  replicas: 0
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

GitOps / FluxCD

To avoid conflicts with Flux and Another Autoscaler, you can remove the field spec.replicas from your deployment manifest and leave Another Autoscaler to manage the number of replicas.

You might also like...
Plays air warning sound when detects a certain phrase or a word in a specified Telegram chat.

Tryvoha Bot Disclaimer: this is more a convenient naming, rather than a real bot. It is designed to play air warning sound when detects a certain phra

Lamblayer: a minimal deployment tool for AWS Lambda layers

lamblayer lamblayer is a minimal deployment tool for AWS Lambda layers. lamblayer does, Create a Layers of built pip-installable python packages. Crea

A discord.py bot template with easy deployment through Github Actions
A discord.py bot template with easy deployment through Github Actions

discord.py bot template A discord.py bot template with easy deployment through Github Actions. You can use this template to just run a Python instance

BioThings API framework - Making high-performance API for biological annotation data

BioThings SDK Quick Summary BioThings SDK provides a Python-based toolkit to build high-performance data APIs (or web services) from a single data sou

A zero-dependency Python library for getting the Kubernetes token of a AWS EKS cluster
A zero-dependency Python library for getting the Kubernetes token of a AWS EKS cluster

tokeks A zero-dependency Python library for getting the Kubernetes token of a AWS EKS cluster. No AWS CLI, third-party client or library (boto3, botoc

A Python script that exports users from one Telegram group to another using one or more concurrent user bots.

ExportTelegramUsers A Python script that exports users from one Telegram group to another using one or more concurrent user bots. Make sure to set all

Transcript-Extractor-Bot - Yet another Telegram Voice Recognition bot but using vosk and supports 20+ languages

transcript extractor Yet another Telegram Voice Recognition bot but using vosk a

Powerful Telegram userbot to turn your PROFILE PICTURE & LAST NAME into a real time clock & to change your BIO automatically.
Powerful Telegram userbot to turn your PROFILE PICTURE & LAST NAME into a real time clock & to change your BIO automatically.

DATE_TIME_USERBOT-TeLeTiPs Powerful Telegram userbot to turn your PROFILE PICTURE & LAST NAME into a real time clock & to change your BIO automaticall

JAKYM, Just Another Konsole YouTube-Music. A command line based Youtube music player written in Python with spotify and youtube playlist support
JAKYM, Just Another Konsole YouTube-Music. A command line based Youtube music player written in Python with spotify and youtube playlist support

Just Another Konsole YouTube-Music Overview I wanted to create this application so that I could use the command line to play music easily. I often pla

Comments
  • Refactor code and allow cronjob suspention

    Refactor code and allow cronjob suspention

    I've implemented cronjob logic for enable and suspend them on start and stop time.

    A lot of code refactor also is included.

    I am already using this logic, and it may useful upstream.

    opened by margori 0
  • Support annotations errors

    Support annotations errors

    If there is an error in an annotation, service stops completely.

    'another-autoscaler/stop-time': '1-59/2 * * *' <- missing last column
    'another-autoscaler/stop-replicas': '' <- empty string is not an integer
    
    opened by margori 1
Releases(0.7)
  • 0.7(Nov 29, 2021)

  • 0.6(Oct 5, 2021)

  • 0.5(Oct 5, 2021)

    • Update Python 3.9.7
    • Rename annotations from another-autoscaler.io to another-autoscaler
    • Add ApiException to catch exceptions from K8s API
    • K8s manifests add namespace another and deploy Another Autoscaler in this new namespace
    Source code(tar.gz)
    Source code(zip)
  • 0.4(Aug 12, 2021)

    This release is for migration from Docker Hub registry to Github registry.

    • Add to the Github actions > Scan vulnerabilities with Trivy
    • Add to the Github actions > Build Docker image
    • Add Deepsource for code review
    • K8s manifest, Image runs as non-root uid 10001 and gid 10001.
    • K8s manifest, create namespace another
    Source code(tar.gz)
    Source code(zip)
  • 0.3(Jul 12, 2021)

    • Project rename to Another Autoscaler.
    • Environment variable (CHECK_EVERY) to configure the number of seconds of each run; By default is 5 seconds.
    • Update ClusterRoleBinding API version to rbac.authorization.k8s.io/v1 on K8s manifest.
    • Refactor of the class AAutoscaler to improve readability.
    Source code(tar.gz)
    Source code(zip)
Owner
Diego Najar
Diego Najar
Quickly visualize docker networks with graphviz.

Docker Network Graph Visualize the relationship between Docker networks and containers as a neat graphviz graph. Example Usage usage: docker-net-graph

Leo Verto 43 Dec 12, 2022
Backend.AI Client Library for Python

Backend.AI Client The official API client library for Backend.AI Usage (KeyPair mode) You should set the access key and secret key as environment vari

Lablup 10 Feb 10, 2022
Discord-Mass-Mention - Yup the title says it all

Protocol - Mass Mention (i havent tested this with any token other than my own t

Mallowies 14 Nov 06, 2022
Kyura-Userbot: a modular Telegram userbot that runs in Python3 with a sqlalchemy database

Kyura-Userbot Telegram Kyura-Userbot adalah userbot Telegram modular yang berjal

Kyura 17 Oct 29, 2022
Telegram Auto Filter Bot

Pro Auto Filter Bot V2.o Hey Mo Tech, I'm an Autofilter bot v2.O and you can not Add Me to your Group. I was made for this one group. So don't waste y

14 Oct 20, 2021
Console XMPP client in python

poezio Homepage: https://poez.io Forge Page: https://lab.louiz.org/poezio/poezio Poezio is a console Jabber/XMPP client. The initial goal was to provi

48 Dec 19, 2022
VC-Music , Playing music without bot.

VC-Userbot A Telegram Userbot to play or streaming Audio and Video songs / files in Telegram Voice Chats. It's made with PyTgCalls and Pyrogram Requir

RioProjectX 8 Aug 04, 2022
Bot interpretation of the carbon.now.sh site

📒 Source code of the @PicodeBot 🧸 Developer: @hoosnick Run $ git clone https://github.com/hoosnick/picodebot.git $ pip install -r requirements.txt P

Husniddin Murodov 13 Oct 02, 2022
🌶️ Give real chat boosting to your discord server.

Chat-Booster Give real chat boosting to your discord server. ✅ Setup: - Add token to scrape messages on server that you whant. - Put the token in

&! Ѵιchy.#0110 36 Nov 04, 2022
Buy early bsc gems with custom gas fee, slippage, amount. Auto approve token after buy

Buy early bsc gems with custom gas fee, slippage, amount. Auto approve token after buy. Sell buyed token with custom gas fee, slippage, amount. And more.

Jesus Crypto 206 May 01, 2022
ByDiego Token Grabber is a Discord Stealer

ByDiego Token Grabber is a Discord Stealer. This way you can get too much information from x person if you pass it on and open it

zByDiegoM.T 4 Mar 11, 2022
AKShare is an elegant and simple financial data interface library for Python, built for human beings

AKShare is an elegant and simple financial data interface library for Python, built for human beings

AKFamily 5.8k Dec 30, 2022
Smilecreator4 - This site is for people who want to hack or want to learn it!

smilecreator4 This site is for people who want to hack or want to learn it! Furthermore, this program does not work without turning off Antivirus or W

1 Jan 04, 2022
Automate saving your Discover Weekly Playlist using Python.

SpotWeekly Automate saving your Discover Weekly Playlist using Python. Made with 3 and FastAPI. The saved playlist link is sent to my discord server

shourya 6 Jan 03, 2022
Yet another Wahrheit-oder-Pflicht bot for Telegram, because all the others suck.

Der WoPperBot Yet another Wahrheit-oder-Pflicht bot for Telegram, because all the others suck. The existing bots are all defunct or incomplete. So I w

Ben Wiederhake 9 Nov 15, 2022
trackbranch is a tool for developers that can be used to store collections of branches in the form of profiles.

trackbranch trackbranch is a tool for developers that can be used to store collections of branches in the form of profiles. This can be useful for sit

Kevin Morris 1 Oct 21, 2021
A collection of scripts to steal BTC from Lightning Network enabled custodial services. Only for educational purpose! Share your findings only when design flaws are fixed.

Lightning Network Fee Siphoning Attack LN-fee-siphoning is a collection of scripts to subtract BTC from Lightning Network enabled custodial services b

Reckless_Satoshi 14 Oct 15, 2022
Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar seu próprio token, e lembrando, é um bot básico, não se utiliza Cogs nem slash commands nele!

BotDiscordPython Aqui está disponível GRATUITAMENTE, um bot de discord feito em python, saiba que, terá que criar seu bot como aplicação, e utilizar s

Matheus Muguet 4 Feb 05, 2022
Bomber-X - A SMS Bomber made with Python

Bomber-X A SMS Bomber made with Python Linux/Termux apt update apt upgrade apt i

S M Shahriar Zarir 2 Mar 10, 2022
One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind them.

AwesomeVersion One version package to rule them all, One version package to find them, One version package to bring them all, and in the darkness bind

Joakim Sørensen 39 Dec 31, 2022