Let’s be honest—most Kubernetes clusters are a little… wasteful.
Dev environments running 24/7. Test workloads idling overnight. Staging pods quietly racking up cloud bills on the weekend.
But what if we could schedule all of that to shut down automatically after hours, and wake back up when the workweek begins?
With kube-green, now we can.
It won’t guess which pods are idle—but it will follow your working hours schedule to cleanly scale down non-critical workloads, helping your team save energy, reduce costs, and embrace greener DevOps.

I/Introducing Kube-Green:
Kube-Green is an open-source Kubernetes controller that suspends idle workloads outside business hours. It’s like a smart power-saving mode for your cluster. Less waste, fewer emissions, and smaller cloud bills. Win-win-win.
In this demo, I’ll show you how to install kube-green and watch it quietly scale down your pods after hours—no scripts, no CRON jobs, no tears.
And that’s it! Now, let kube-green sleep your pods and save CO2!
II/Automate Your Cluster’s Power Saving: Installing And Using kube-green
✅ Step 1: Install the cert-manager
– With this command, the latest release of cert-manager will be installed.
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
– You can check the correct cert-manager deployment by verifying that all the pods are running correctly.
kubectl -n cert-manager get pods

✅ Step 2: Install kube-green into your cluster
– You can apply the official manifest directly from the GitHub repo:
kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml
– kube-green will be installed in the kube-green namespace, and you can check the installation status by running:
kubectl get pods --namespace kube-green

✅ Step 3: Create a SleepInfo schedule
– This tells kube-green when to scale down workloads and which namespaces to target.
– Here’s a sample sleepinfo.yaml:
apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
name: include-with-labels
spec:
weekdays: "*"
sleepAt: "21:45"
wakeUpAt: "22:00"
timeZone: "Asia/Ho_Chi_Minh"
includeRef:
- matchLabels:
kube-green.dev/include: “true”
– This SleepInfo
resource defines a scheduled sleep/wake rule using kube-green that:
- Applies only within the namespace where this SleepInfo is created
- Targets specific workloads (like Deployments, StatefulSets, etc.) that have a matching label kube-green.dev/include: true
- Schedules a daily sleep at 21:45 (9:45 PM) and a wake-up at 22:00 (10:00 PM)
- Uses the Asia/Ho_Chi_Minh time zone
- Runs every day of the week (
weekdays: "*"
)
– It’s perfect for saving cloud resources in development environments during off-hours—especially when those workloads don’t need to run 24/7.
✅ Step 4: Apply the sleepinfo.yaml schedule on namespace dev
– The SleepInfo
schedule only takes effect in the same namespace where the SleepInfo
object is created, does not affect workloads outside its own namespace.
kubectl apply -f sleepinfo.yaml

✅ Step 5: Ensure dev namespace exists
kubectl create namespace dev
✅ Step 6: Apply deployment with the correct label
– Create nginx-sleep-demo.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-sleep-demo
namespace: dev
labels:
app: nginx
kube-green.dev/include: "true" # This matches the SleepInfo label selector
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
kube-green.dev/include: "true"
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
– Apply it:
kubectl apply -f nginx-sleep-demo.yaml
– Verify the deployment is running with 3 replicas

III/Observe kube-green action at the schedule:
– Assuming your SleepInfo is configured to:
- Sleep at 21:45
- Wake up at 22:00
- Based on time zone: Asia/Ho_Chi_Minh
🕒 At 21:45: kube-green has automatically scaled the Deployment down to 0 replicas.
kubectl get deployment nginx-sleep-demo -n dev

*Note: The timestamp shown in the image is Thu May 22 14:45:00 UTC 2025
, which is in Coordinated Universal Time (UTC).
Since Vietnam (Asia/Ho_Chi_Minh time zone) is UTC+7, this corresponds to 21:45 local time.
This matches the sleepAt: "21:45"
setting in your SleepInfo
configuration—confirming that kube-green triggered the scale-down action at the correct local time.
🕙 At 22:00:
Run again:
kubectl get deployment nginx-sleep-demo -n dev
✅ kube-green has restored the original replica count (3 replicas).

🌱 Conclusion: Clean Code, Cleaner Clusters
In a world where compute runs 24/7, it’s easy to forget how much energy is quietly consumed by idle workloads. With kube-green, we get a simple but powerful reminder: not everything needs to stay awake all the time.
By scheduling your dev and test environments to rest after hours, you’re not just cutting cloud costs—you’re building habits that scale sustainably. It’s a small step toward greener infrastructure, and a smarter one too.
So next time your cluster is sleeping, smile—you just saved some CPUs and the planet. ☁️💤🌍
“Why let your pods party all night when no one’s watching? Let them sleep. You should too.”
— TechNoStress