Skip to main content
Welcome — this lesson explains how to use KEDA’s Cron scaler to schedule Kubernetes pod replicas based on time. Cron-based scaling is ideal for predictable traffic patterns (for example, a coffee shop that opens at 6:00 AM daily, or scheduled promotions). With KEDA’s Cron trigger you can:
  • Select a timezone from the IANA Time Zone Database.
  • Define cron expressions for when scaling should start and when it should end.
  • Set the exact replica count (desiredReplicas) for the scheduled window.
Start and end times must be distinct: KEDA applies the scheduled replica count between the start and end boundaries and removes that constraint afterwards so the workload can resume its normal scaling behavior.
An infographic titled "KEDA Cron" showing a stylized framed list of scheduled items. A blue circle labeled "Cron" sits to the left and a callout to the right reads "Start and end time should be distinct."

Why use Cron scaling?

If you can predict times of higher load, pre-warming or pre-scaling your workloads reduces cold-start latency and improves user experience. KEDA Cron scaling provides a deterministic window to guarantee capacity during those events and to return to lower capacity afterward.

How the Cron trigger works

A KEDA Cron trigger accepts the following key metadata fields:
  • timezone — an IANA time zone string (for example, Asia/Kolkata). Use values from the IANA Time Zone Database.
  • start and end — cron expressions that define when the scheduled replica count should be applied and when it should stop being enforced.
  • desiredReplicas — the number of replicas to maintain during the scheduled period (KEDA expects this as a string).
Cron expressions in KEDA follow the standard 5-field format: minute hour day-of-month month day-of-week Use 24-hour format for the hour field.

Cron field reference

Example: 0 6 * * * → run at 06:00 every day.

Example trigger metadata

Always use a valid IANA timezone string for timezone and provide cron expressions in 24-hour format. Quote cron expressions and desiredReplicas to avoid parsing issues.

Example ScaledObject

Below is a complete example ScaledObject that applies the cron schedule above. This manifest includes:
  • minReplicaCount: 0 to allow scaling down to zero outside scheduled windows.
  • cooldownPeriod (seconds) — the time KEDA waits after the last active trigger before scaling down. This helps prevent rapid down-scaling after brief spikes.

Notes on cooldown and behavior

  • cooldownPeriod is the number of seconds KEDA waits after the last active trigger observation before attempting to scale down. For long scheduled windows (e.g., 06:00–20:00) this setting usually does not impact the scheduled period, but it can help avoid oscillation when other scalers are active.
  • When the end cron expression matches, KEDA removes the scheduled desired replica count and other scalers (or the default behavior) determine the replica count. That may trigger a gradual scale-down according to your configuration.

When to use KEDA Cron scaler

  • Predictable, time-based traffic (daily business hours, scheduled promotions, batch processing windows).
  • Need to guarantee minimum capacity for a known window (pre-warming).
  • Desire to scale to zero outside scheduled windows to save resources.

References

Watch Video

Practice Lab