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
Automatically send commands to send Twitch followers to any Twitch account.

Automatically send commands to send Twitch followers to any Twitch account. You just need to be in a Twitch follow bot Discord server!

Thomas Keig 6 Nov 27, 2022
Analog clock that shows the weather instead of the actual numerical hour it points to.

Eli's weatherClock An digital analog clock but instead of showing the hours, the clock shows the weather at that hour of the day. So instead of showin

Kovin 154 Dec 01, 2022
A client interface for Scrapinghub's API

Client interface for Scrapinghub API The scrapinghub is a Python library for communicating with the Scrapinghub API. Requirements Python 2.7 or above

Scrapinghub 184 Sep 28, 2022
New developed moderation discord bot by archisha

Monitor42 New developed moderation discord bot by αrchιshα#5518. Details Prefix: 42! Commands: Moderation Use 42!help to get command list. Invite http

Kamilla Youver 0 Jun 29, 2022
Visual Weather api. Returns beautiful pictures with the current weather.

VWapi Visual Weather api. Returns beautiful pictures with the current weather. Installation: sudo apt update -y && sudo apt upgrade -y sudo apt instal

Hotaru 33 Nov 13, 2022
ChannelActionsBot - Channel Actions Bot With Python

ChannelActionsBot Can be found on telegram as @ChannelActionsBot! Features Auto

Aditya 56 Dec 30, 2022
A fast, easy to set up telegram userbot running Python 3 which uses fork of the Telethon Library.

forked from friendly-telegram/friendly-telegram Friendly Telegram Userbot A fast, easy to set up telegram userbot running Python 3 which uses fork of

GeekTG 75 Jan 04, 2023
A telegram smoot and high quality music player bot.

▪︎ Music Player ▪︎ A smooth telegram music bot with high quality songs ■ [Features] • Fast Starts streaming your inputs while downloading and converti

Simple Boy 3 Feb 05, 2022
A multi-purpose Discord bot with simple moderation commands, reaction roles, reminders, and much more!

Nokari This is the rewrite of Nokari. There are still a lot of things to be done. I'm still working on the internal logic, so the bot basically has no

Norizon 13 Nov 17, 2022
Network simulation tools

Overview I'm building my network simulation environments with Vagrant using libvirt plugin on a Ubuntu 20.04 system... and I always hated how boring i

Ivan Pepelnjak 219 Jan 07, 2023
Simple screen recorder

Kooha Simple screen recorder Description Kooha is a simple screen recorder built with GTK. It allows you to record your screen and also audio from you

Dave Patrick 1.2k Jan 03, 2023
BT CCXT Store

bt-ccxt-store-cn backtrader是一个非常好的开源量化回测平台,我自己也时常用它,backtrader也能接入实盘,而bt-ccxt-store就是帮助backtrader接入数字货币实盘交易的一个插件,但是bt-ccxt-store的某些实现并不是很好,无节制的网络轮询,一些

moses 40 Dec 31, 2022
Quack-SMS-BOMBER - Quack Toolkit By IkigaiHack

Quack Toolkit By IkigaiHack About Quack Toolkit Quack Toolkit is a set of tools

Marcel 2 Aug 19, 2022
Automates the process to obtain an appointment for NIE in spain.

get-nie-appointment A Python script that automates the process of getting an appointment for NIE assignation. It can be modified in order to change th

Ezequiel Aceto 39 Nov 28, 2022
A GitHub Follower Bot that is a WIP.

GitHub Follower Bot (WIP) Work In Progress This bot is a WIP. There are still many features I plan to add and code I need to improve (I'm still fairly

Christian Deacon 71 Dec 29, 2022
Gorrabot is a bot made to automate checks and processes in the development process.

Gorrabot is a Gitlab bot made to automate checks and processes in the Faraday development. Features Check that the CHANGELOG is modified By default, m

Faraday 7 Dec 14, 2022
A simple library for interacting with Amazon S3.

BucketStore is a very simple Amazon S3 client, written in Python. It aims to be much more straight-forward to use than boto3, and specializes only in

Jacobi Petrucciani 219 Oct 03, 2022
Aria/qBittorrent Telegram mirror/leech bot

This Telegram Bot written in Python for mirroring files on the Internet to our Google Drive or Telegram. Based on python-aria-mirror-bot Features: qBi

Anas 2.1k Jan 04, 2023
A simple Telegram bot that can add caption to any media on your channel

Channel Auto Caption This bot can add a caption for any media/document sent to a channel. Just deploy bot and add bot as admin to a channel. Deploy to

22 Nov 14, 2022
Administration Panel for Control FiveM Servers From Discord

FiveM Discord Administration Panel Version 1.0.0 If you would like to report an issue or request a feature. Join our Discord or create an issue. Contr

NIma 9 Jun 17, 2022