Snorlax: Automating Kubernetes Deployment Wake and Sleep Schedules

Summary
Snorlax is a Kubernetes operator that automates the waking and sleeping of deployments on a schedule. This tool provides significant cost savings, enhanced security, and environmental benefits by scaling down environments when not in use. It also includes a wake server that brings deployments back online upon request, displaying a splash page during the process.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
Snorlax is a Kubernetes operator that intelligently manages the lifecycle of your deployments by waking them up and putting them to sleep based on a predefined schedule. Beyond simple scheduling, Snorlax can update ingresses to point to a "wake server" when deployments are asleep. If a request comes in during sleep, the wake server displays a "waking up" splash page and automatically brings the deployments back online, restoring ingresses once they are ready.
Installation
To get started with Snorlax, you can install it using Helm. Follow these steps:
helm repo add moonbeam https://moonbeam-nyc.github.io/helm-charts
helm repo update
helm install snorlax moonbeam/snorlax --create-namespace --namespace snorlax
Examples
After installation, define your SleepSchedule resource to specify the wake and sleep times for your deployments. Here's an example:
apiVersion: snorlax.moonbeam.nyc/v1beta1
kind: SleepSchedule
metadata:
namespace: your-app-namespace
name: your-app
spec:
wakeTime: '8:00am'
sleepTime: '10:00pm'
deployments:
- name: your-app-frontend
- name: your-app-db
- name: your-app-redis
ingresses:
- name: your-app-ingress
requires:
- deployment:
name: your-app-frontend
timezone: 'America/New_York'
Apply this resource using kubectl:
kubectl apply -f your-app-sleep-schedule.yaml
Why Use Snorlax?
Implementing Snorlax in your Kubernetes environments offers several compelling advantages:
- Cost Savings: Significantly reduce cloud resource consumption by scaling down non-essential environments overnight or during weekends. For example, sleeping staging environments for 8 hours daily and on weekends can lead to approximately 55% savings on cloud bills for those resources.
- Security: Minimize your infrastructure's attack surface by ensuring deployments are not active when they are not needed.
- Environmentally Responsible: Contribute to a greener footprint by reducing the energy consumption of your cloud infrastructure.
Links
For more detailed information, contributions, or to explore the source code, visit the official Snorlax GitHub repository: