Skip to main content
This guide explains how to configure KEDA (Kubernetes Event-driven Autoscaling) to automatically scale your Sawmills Collector based on real-time metrics. KEDA enables dynamic, event-driven scaling, ensuring your collector adapts to changing workloads efficiently.

Prerequisites

Before you begin, ensure you have:
  • The Sawmills Collector deployed and running in the sawmills namespace
  • KEDA installed in your Kubernetes cluster (KEDA installation guide)
  • (Optional) Prometheus deployed if you want to use Prometheus-based scaling

Enabling KEDA Autoscaling for Sawmills

KEDA can be enabled and configured via the Sawmills Collector Helm chart. For remote-operator installs, the configuration is managed under the managedChartsValues.sawmills-collector.keda section in your values.yaml file. The legacy managedCharts key still works as an alias.

Step 1: Enable KEDA in Helm Values

Add or update the following section in your values.yaml of the remote operator:
  • minReplicas/maxReplicas: Minimum and maximum number of collector pods.
  • pollingInterval: How often KEDA checks metrics for scaling decisions.
  • cooldownPeriod: How long to wait after scaling before scaling down.
  • scaling: Configure one or more scaling sources (Prometheus, external, CPU, memory).

Step 2: Apply the Configuration

After updating your values.yaml, upgrade your Sawmills Collector release:

KEDA Scaling Options

You can configure KEDA to scale based on different metrics sources:

1. Prometheus-based Scaling

Enable scaling.prometheus.enabled: true and provide the Prometheus server address and PromQL query. Example:

2. External Scaler (OTLP) Scaling

Enable scaling.external.enabled: true to use the KEDA OTLP external scaler. Example:

3. CPU/Memory-based Scaling

Enable scaling.cpu.enabled and/or scaling.memory.enabled to scale based on resource utilization:

Example: Full KEDA Configuration

Here is a complete example for enabling KEDA with multiple scaling sources:

KEDA Scaler Component for OpenTelemetry

The Sawmills Helm chart includes an optional KEDA scaler component for advanced OTLP-based scaling. To enable it, set:
Refer to the Helm chart documentation for advanced configuration options.

Verifying KEDA Autoscaling

  1. Check KEDA ScaledObject
  2. Check Collector Pod Scaling
  3. Check KEDA Operator Logs

Troubleshooting KEDA Autoscaling

  • ScaledObject Not Created: Ensure keda.enabled: true and Helm upgrade completed successfully.
  • Pods Not Scaling: Check metric queries, thresholds, and KEDA operator logs for errors.
  • Prometheus/External Metrics Not Detected: Verify Prometheus/external scaler endpoints are reachable and queries return expected results.
  • Resource-based Scaling Not Working: Ensure CPU/memory requests and limits are set on the collector pods.
  • Existing HPA Still Owns Scaling: If you enabled KEDA on an existing collector, check for an old HPA targeting the same collector workload. KEDA creates and manages its own HPA through the ScaledObject.

Best Practices for KEDA with Sawmills

  • Start with conservative scaling thresholds and adjust based on observed workloads.
  • Use multiple scaling sources (e.g., CPU and Prometheus) for robust autoscaling.
  • Monitor KEDA and collector logs for scaling anomalies.
  • Test scaling behavior under simulated load before deploying to production.
  • For advanced scenarios, leverage the external scaler for custom OTLP metrics.

References

For further assistance with KEDA configuration for Sawmills, contact the Sawmills team or consult the Collector Customization Guide.