Open Source Operator

Auto-hibernate Kubernetes workloads to save 70-80% on costs

Scale dev/staging environments to zero when idle. Wake them on-demand with a beautiful waiting page. Works with Deployments, StatefulSets, and CloudNativePG databases.

Install with one command:

kubectl apply -f https://github.com/athalabs/sleepyservice/releases/latest/download/install.yaml
Auto-hibernation after idle timeout
On-demand wake with real-time progress
CloudNativePG database support
Dependency management (DB → App)
TestsCoverageGo ReportLicense

The Problem

Development and staging environments sit idle most of the time but keep burning resources 24/7.

Constant Resource Burn
Dev and staging environments run 24/7 even when no one is using them, wasting 70-80% of compute resources during nights and weekends.
Fragile Manual Scripts
Manual kubectl scale commands and cron jobs are error-prone. Someone always forgets to wake things up before the demo.
Stateful Workload Challenges
Traditional scale-to-zero solutions like Knative don't work well with databases and StatefulSets, leaving your most expensive resources always on.
Poor Wake-Up Experience
Users hitting a sleeping service get confusing errors or timeouts instead of a clear explanation that the service is starting up.

How It Works

SleepyService creates a smart proxy in front of your workloads that orchestrates the entire wake-up sequence.

┌─────────┐      ┌──────────────┐      ┌─────────────┐
│  User   │─────▶│  Wake Proxy  │─────▶│   Backend   │
└─────────┘      └──────────────┘      │ (Your App)  │
                        │              └─────────────┘
                        │                     │
                        │              ┌─────────────┐
                        │              │  Database   │
                        │              │   (CNPG)    │
                        │              └─────────────┘
                        ▼
                 ┌──────────────┐
                 │ SleepyService│
                 │  Controller  │
                 └──────────────┘
1

Sleeping State

All components (deployments, databases) are scaled to zero. No resources consumed.

2

Traffic Arrives

Wake proxy intercepts incoming requests and triggers the wake-up sequence through the controller.

3

Waiting Page

Users see a beautiful waiting page with real-time progress updates via Server-Sent Events showing which components are starting.

4

Components Wake

Controller scales components in dependency order (database first, then app), waits for health checks, then marks service as awake.

5

Traffic Flows

Once ready, proxy forwards traffic normally. After configured idle time, everything scales back to zero automatically.

Quick Start

Get started in minutes. Install the operator, create a SleepyService resource, and you're done.

Prerequisites

  • Kubernetes cluster v1.11.3+
  • kubectl v1.11.3+

Installation

Install the operator with a single command:

kubectl apply -f https://github.com/athalabs/sleepyservice/releases/latest/download/install.yaml

Basic Example

Create a SleepyService that manages a PostgreSQL database and a web application:

sleepyservice.yamlyaml
apiVersion: sleepy.atha.gr/v1alpha1
kind: SleepyService
metadata:
  name: my-app
spec:
  idleTimeout: 15m
  components:
    - name: postgres
      type: CNPGCluster
      ref:
        name: my-db
    - name: app
      type: Deployment
      ref:
        name: my-app
      replicas: 2
      dependsOn:
        - postgres

Apply it with kubectl apply -f sleepyservice.yaml

Access your app through the proxy service (my-app.default.svc.cluster.local), and it will wake up automatically when traffic arrives!

Features

Everything you need for intelligent workload hibernation

Auto-Hibernation
Automatically scales workloads to zero after configurable idle timeout. Set it and forget it - no manual intervention needed.
On-Demand Wake-Up
Beautiful waiting page with real-time progress via SSE. API requests are held and proxied transparently once ready.
Dependency Management
Orchestrate wake-up order with dependsOn. Wake database before application, ensure proper startup sequence every time.
CloudNativePG Support
First-class support for CloudNativePG PostgreSQL clusters. Hibernate entire full-stack applications including databases.
Health Check Integration
Configurable health check paths ensure components are truly ready before forwarding traffic. No errors, no downtime.
Manual Control APIs
HTTP endpoints for triggering wake/hibernate manually. Perfect for CI/CD pipelines or maintenance windows.

Perfect For

SleepyService shines in environments with sporadic usage patterns

Dev/Staging
Development and staging environments that sit idle outside business hours. Save 70-80% on costs.
PR Previews
Preview environments for pull requests. Only consume resources when developers are reviewing.
Demo Apps
Demo applications with sporadic usage. Always available when needed, zero cost when idle.
Cost Optimization
Any environment where availability matters but usage is intermittent. Reduce waste without sacrificing access.

More Examples

See how SleepyService handles different workload types

Basic example with a single Deployment. Hibernates after 30 minutes of inactivity.

simple-app.yamlyaml
apiVersion: sleepy.atha.gr/v1alpha1
kind: SleepyService
metadata:
  name: demo-app
spec:
  idleTimeout: 30m

  components:
    - name: web
      type: Deployment
      ref:
        name: demo-web
      replicas: 1

Technical Details

Built on Kubebuilder with production-grade reliability

Supported Resource Types

Deployment

Standard Kubernetes deployments with replica management

StatefulSet

Stateful workloads with ordered scaling support

CNPGCluster

CloudNativePG PostgreSQL database clusters

Wake Proxy API Endpoints

GET/_wake/status- JSON status of current state
GET/_wake/events- SSE stream for real-time updates
POST/_wake/trigger- Manually trigger wake-up
POST/_wake/hibernate- Manually trigger hibernation
GET/_wake/health- Proxy health check

State Management

SleepyService uses a simple state machine with the following states:

Sleeping
All components scaled to zero
Waking
Components starting in dependency order
Awake
All components ready, traffic flowing
Hibernating
Scaling down after idle timeout
Error
Wake-up failed or timed out

Real-World Impact

Proven results from production deployments

70-80%
Cost Reduction
Average cost savings on dev and staging environments. Resources only run when actually in use.
30-60s
Wake-Up Time
Typical wake-up time depending on workload. Users see progress in real-time via beautiful waiting page.
Zero
Manual Intervention
Set it and forget it. Automatic hibernation and wake-up with no manual scripts or commands needed.

Frequently Asked Questions

Open Source & Community

SleepyService is open source and built with Kubebuilder. We welcome contributions, feedback, and bug reports.

License

Apache 2.0

Built With

Kubebuilder

Language

Go 1.25+

Ready to save on infrastructure costs?

Start hibernating your dev/staging environments today. Free, open source, and ready to deploy.

Install with one command:

kubectl apply -f https://github.com/athalabs/sleepyservice/releases/latest/download/install.yaml

Free • Open Source • Apache 2.0 Licensed