# HA OTel scaler

In active-active mode, every OTel scaler replica keeps its own in-memory history of the same metrics. If one replica fails, another can answer KEDA with the samples it already has.

## Enable HA

Add these values to your [OTel scaler release](https://docs.kedify.io/how-to/otel-scaler-installation/) using chart `otel-add-on` v0.1.6 or later. Enabling HA replaces the Deployment with a StatefulSet. Its Pods build new history as samples arrive.

```yaml
settings:
  ha:
    enabled: true
    replicas: 3
```

Keep `settings.metricStore.lazySeries` and `settings.metricStore.lazyAggregates` at their default of `false` so all replicas collect the series and aggregates KEDA can query.

## How metrics reach every replica

[![Each Collector exporter sends the same samples to its own scaler Pod using the headless Service’s per-Pod DNS. KEDA connects to one ready Pod through a separate Service.](https://docs.kedify.io/assets/images/docs/ha-otel-scaler.svg)](https://docs.kedify.io/assets/images/docs/ha-otel-scaler.svg)

Scroll to exploreDiagram description

The OTel Collector configures one OTLP exporter per scaler replica, three by default. Each row follows one exporter through its Pod's DNS name under the headless Service to the matching StatefulSet Pod. All three receive the same samples, including Pod 0 while it warms up. KEDA uses a separate ClusterIP Service to query one ready Pod per connection, shown here as Pod 2.

The headless Service sets `publishNotReadyAddresses: true`, so the Collector can resolve each Pod by name and send it OTLP metrics while it warms up.

- **Chart-managed Collector.** The chart creates one exporter per Pod from the bundled Collector’s `otlp` exporter or an operator-managed Collector’s `otlp/keda` exporter. Each has its own queue and retries.

- **External Collector or existing ConfigMap.** Configure one OTLP exporter per Pod and list all of them in the same metrics pipeline. For release `kedify-otel-scaler` in namespace `keda`, the first endpoint is `kedify-otel-scaler-0.kedify-otel-scaler-h.keda.svc:4317`. Use ordinals `1` and `2` for the other two. Applications that push OTLP can send to the Collector’s receiver.

## How KEDA selects a replica

Keep the trigger’s `scalerAddress` at `kedify-otel-scaler.keda.svc:4318` for this release. The ClusterIP Service selects one ready Pod for each new gRPC connection. Selection can be random or round-robin depending on the cluster. All queries on that connection go to the same Pod.

A replica normally passes `/readyz` once the warmup period has elapsed and it has fresh samples with distinct timestamps. Warmup begins at the first fresh sample. It uses `settings.metricStore.retentionSeconds` (90 seconds by default) unless you set `settings.ha.warmupSeconds` to a positive value. If samples go stale, the replica closes its KEDA listener so KEDA can reconnect. OTLP ingestion stays open.

At startup, the Pod can become Ready early when `settings.ha.makeReadyAfterSeconds` expires (default `105`), or while the chart installs operator-managed Collectors. The KEDA listener opens only after full warmup or after both the deadline and a fresh sample. Queries with insufficient history return `Unavailable`. Set the deadline to `0` to require full warmup before accepting connections.

---
Canonical: https://docs.kedify.io/how-to/ha-otel-scaler/
Source: src/content/docs/how-to/ha-otel-scaler.md
Documentation index: https://docs.kedify.io/llms.txt
