Schedule Kubernetes Horizontal Pod Autoscaling (HPA) using KEDA’s Cron trigger to automatically adjust replica counts at specific times. This approach helps you:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Handle predictable traffic spikes (e.g., morning rush).
- Save resources by scaling down during idle periods.
- Automate capacity management for promotional events.
How KEDA Cron Triggers Work
A Cron trigger in KEDA allows you to:- Specify an IANA timezone for scheduling.
- Define start and end times with standard CRON expressions.
- Set a
desiredReplicascount for the active window.
start expression, KEDA scales the target Deployment up to desiredReplicas. After the end expression, it scales back down (respecting your minReplicaCount).
Common Use Cases
| Scenario | Schedule | Benefit |
|---|---|---|
| Daily Traffic Spike | 0 6 * * * – 0 8 * * * | Pre-warm pods for morning users |
| Promotional Campaign | 0 12 * * 5 – 0 18 * * 5 | Extra capacity during Friday sales |
| Off-Hours Optimization | 0 20 * * * – 0 6 * * * | Scale down to save costs overnight |

When to Use Time-Based Scaling
- Predictable Load Windows: Morning routines, lunch peaks, end-of-business-day reporting.
- Short-Lived Events: Flash sales, marketing campaigns.
- Cost Management: Turn off extra capacity when it isn’t needed.
24-Hour Scaling Graph

- Baseline: Default replica count until 06:00.
- Scale-Up: Jump to
desiredReplicasduring the 6:00–20:00 window. - Scale-Down: Return to baseline after 20:00.
Defining the Cron Trigger in KEDA
Add a Cron trigger underspec.triggers in your ScaledObject manifest:
| Field | Range | Description |
|---|---|---|
| minute | 0–59 | Minute of the hour |
| hour | 0–23 | Hour of the day |
| day-of-month | 1–31 | Date |
| month | 1–12 | Month number |
| day-of-week | 0–6 | Weekday (Sun=0) |
Make sure to use the exact IANA timezone string (e.g.,
America/New_York). An incorrect value can prevent your schedule from triggering.Complete ScaledObject Example
Below is a full example combining the Cron trigger with a Deployment target. It scalesmy-deployment up to 10 replicas between 06:00 and 20:00 Asia/Kolkata time, then scales down to zero after a 5 minute cooldown.