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
🤟The VC Music Source code of @DaisyXBot ❤️ v3 Out now

DAISYXMUSIC V3 🎵 A bot that can play music on telegram group's voice call Available on telegram as @DaisyXbot Whats new 🔥 Thumbnail Support Playlist

TeamDaisyX 207 Dec 05, 2022
Luna Rush Auto Clicker Bot

Luna Rush Auto Clicker Bot Se o aplicativo lhe ajudar de alguma forma, uma doação para ajudar a pagar a conta de luz sempre é bem vinda ;) Wallet Smar

Walter Discher Cechinel 29 Dec 20, 2022
A very basic starter bot based on CryptoKKing with a small balance

starterbot A very basic starter bot based on CryptoKKing with a small balance, use at your own risk. I have since upgraded this script significantly a

Danny Kendrick 2 Dec 05, 2021
A multifunctional bot for Discord

Um bot multifuncional e divertido para Discord Estive desenvolvendo o BotDaora desde o começo de outubro de 2021 e agora ele é open-source! tomei essa

Ruan 4 Dec 28, 2021
LyricsGenius: a Python client for the Genius.com API

LyricsGenius: a Python client for the Genius.com API lyricsgenius provides a simple interface to the song, artist, and lyrics data stored on Genius.co

KevinChunye 2 Jun 30, 2022
The most fresh and updateable Telegram userbot. By one of the most active contibutors to GeekTG

Installation Script installation: Simply run this command out of root: . (wget -qO- http://gg.gg/get_hikka) Manual installation: apt update && apt in

Dan Gazizullin 150 Jan 04, 2023
A better rename and convert bot with upload mode option and Auto detection

A better rename and convert bot with upload mode option and Auto detection

Code X Mania 2 Nov 09, 2021
an API to check if a url or IP address is safe or phishing

an API to check if a url or IP address is safe or phishing. Using a ML model. The API created using FastAPI.

Adel Dahani 1 Feb 16, 2022
A Discord API Wrapper for Userbots/Selfbots written in Python.

DisCum A simple, easy to use, non-restrictive, synchronous Discord API Wrapper for Selfbots/Userbots written in Python. -using requests and websockets

Liam 450 Dec 27, 2022
VideoMergeDcBot1 - Video Merge Dc Bot for telegram

VIDEO MERGE BOT An Telegram Bot Demo 👉 @VideoMergeDcBot To Merge multiple Video

Selfie SD 2 Feb 04, 2022
Reddit bot that uses sentiment analysis

Reddit Bot Project 2: Neural Network Boogaloo Reddit bot that uses sentiment analysis from NLTK.VADER WIP_WIP_WIP_WIP_WIP_WIP Link to test subreddit:

TpK 1 Oct 24, 2021
Boilerplate template for the discord-py-interactions library

discord-py-interactions_boilerplate Boilerplate template for the discord-py-interactions library Currently, this boilerplate supports discord-py-inter

Ventus 7 Dec 03, 2022
A Simple Telegram Bot By @AsmSafone to Download Files From Mega.nz and Upload It to Telegram

MegaDL-Bot A Simple Telegram Bot By @AsmSafone to Download Files From Mega.nz and Upload It to Telegram Features No Login Required All Mega.nz File Li

SAF ONE 92 Dec 02, 2022
This repository contains ready to deploy automations on AWS

aws-automation-plugins This repository contains ready to deploy automations on AWS. How-To All projects in this repository contain a deploy.sh file wh

Akesh Patil 8 Sep 20, 2022
This is my Discord-Bot named priamoryki-bot based on python.

This is my Discord-Bot named priamoryki-bot based on python. It's a public repository without private information, so you need to correct some code for everything to be working.

priamoryki 2 Dec 14, 2022
A discord self bot that replies to messages using cleverbot

cleverbot-discord-self A discord self bot that replies to messages using cleverbot Bot will respond to DMs and channels in the channels list. Need to

0 Jan 11, 2022
YouTube bot, this is just my introduction to api and requests, this isn't intended on being an actual view bot.

YouTube bot, this is just my introduction to api and requests, this isn't intended on being an actual view bot.

Aran 2 Jul 25, 2022
You cant check for conflicts until course enrolment actually opens. I wanted to do it earlier.

AcornICS I noticed that Acorn it does not let you check if a timetable is valid based on the enrollment cart, it also does not let you visualize it ea

Isidor Kaplan 2 Sep 16, 2021
Check and write all account info + Check nitro on account

Discord-Token-Checker Check and write all account info + Check nitro on account Also check https://github.com/GuFFy12/Discord-Token-Parser (Parse disc

36 Jan 01, 2023
Companion "receiver" to matrix-appservice-webhooks for [matrix].

Matrix Webhook Receiver Companion "receiver" to matrix-appservice-webhooks for [matrix]. The purpose of this app is to listen for generic webhook mess

Kim Brose 13 Sep 29, 2022