Technical Insight Explanation

Knative vs KEDA vs HPA: Three Different Approaches to Autoscaling

Compare scaling signals, control loops, activation from zero and operational trade-offs across HPA, KEDA and Knative.

Knative vs KEDA vs HPA: Three Different Approaches to Autoscaling
On this page

Three autoscalers. One Kubernetes cluster. Three different interpretations of demand.

A CPU-intensive API, an idle HTTP endpoint and a queue consumer may all need more replicas. But the signal that tells us when to create those replicas is not necessarily the same. Choosing an autoscaler by its feature list misses the underlying control problem.

In Understanding Knative: How Scale-to-Zero Actually Works we explored request concurrency; in Knative Eventing: Building Event-Driven Applications on Kubernetes we examined asynchronous delivery. Now we compare the scaling mechanisms that fit those workloads.

HPA: scale an existing workload

The Horizontal Pod Autoscaler is a Kubernetes controller that adjusts the scale subresource of a target workload. It can consume resource, custom and external metrics through the corresponding metrics APIs. CPU utilization is relative to requested CPU, so missing requests undermine that signal.

The simplified proportional calculation is ceil(currentReplicas × currentMetric / desiredMetric). Tolerance, missing metrics, readiness, stabilization and scaling policies modify the result. HPA is not a request router and normally maintains at least one replica. Specialized scale-to-zero support depends on feature gates and eligible metrics; do not assume it is available in a standard cluster.

KEDA: observe work outside the workload

KEDA uses scalers to observe external demand, such as queue depth. A ScaledObject targets a scalable workload. KEDA manages activation and deactivation around zero and typically creates an HPA for scaling between positive replica counts. A ScaledJob is a different abstraction that creates Jobs rather than scaling a Deployment.

Scaling ownership

The queue can hold work while consumers are absent. This is why queue-driven activation does not need the same HTTP request buffering mechanism as Knative Serving. KEDA’s core does not automatically intercept arbitrary incoming HTTP requests; separate HTTP integrations have their own semantics.

Polling intervals, activation thresholds and cooldown periods influence the transition around zero. HPA behavior influences positive replica scaling. A scaler error is not equivalent to an empty queue. Monitor metric availability and configure fallback behavior where supported.

Knative: scale a request-driven Revision

Knative Serving coordinates application routing, activation and replica scaling. KPA observes concurrency or request rate, depending on configuration. The Activator provides a path for requests when ready capacity is insufficient. Revision-level policies define scaling targets and bounds.

Knative can also use an HPA-based autoscaler class for supported configurations, but that is distinct from the default KPA path and does not provide KPA scale-to-zero behavior. Eventing is not the Serving autoscaler.

Compare the contracts

DimensionHPAKEDA ScaledObjectKnative Serving (KPA)
TargetScalable workloadScalable workloadRevision
Typical signalCPU or custom metricQueue or external metricRequest concurrency or rate
Activation from zeroNot typicalSupported for eligible scalersSupported for request traffic
HTTP routingNoNot in coreYes
Revision traffic splittingNoNoYes
Positive replica scalingHPAManaged HPAKPA
Additional infrastructureMetrics APIsOperator, metrics adapter, event sourceServing and networking components

Three workloads, three signals

Consider an API with sustained CPU pressure. HPA is a reasonable starting point when CPU correlates with the bottleneck and requests are correctly specified. If the API waits on a slow database, CPU may remain low even as latency rises; a custom metric may be more appropriate.

Consider a queue with 1,000 pending messages and a target of 20 messages per replica. A simple backlog-based estimate suggests 50 replicas, subject to bounds. That does not establish the drain time: processing throughput, arrival rate and downstream limits matter. KEDA is a natural fit when the queue can persist work during activation.

Finally, consider an internal HTTP endpoint receiving sporadic bursts. Knative can activate the endpoint from zero and route traffic during the transition. If the first request has a strict latency budget, keep warm capacity or reduce startup time rather than assuming activation is instantaneous.

Demand signals

A practical HPA and KEDA comparison

The first manifest (hpa.yaml) targets an existing Deployment named api, whose containers must have CPU requests configured:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: api
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api
  minReplicas: 1
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70

The second manifest (scaledobject.yaml) targets a separate Deployment named worker and uses a Prometheus metric representing queue depth:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: worker
spec:
  scaleTargetRef:
    name: worker
  minReplicaCount: 0
  maxReplicaCount: 50
  triggers:
    - type: prometheus
      metadata:
        serverAddress: http://prometheus.monitoring.svc:9090
        query: sum(queue_depth)
        threshold: "20"

The endpoint and metric are placeholders that must be adapted to a real queue exporter. The query must return a single numeric result. A production setup needs appropriate authentication and error handling.

Do not apply both manifests to the same workload. KEDA owns its generated HPA; adding an independent HPA to the same scale target introduces conflicting desired replica writes. Similarly, do not attach an external HPA to a KPA-managed Revision Deployment.

Inspect ownership and behavior:

kubectl get hpa -A
kubectl get scaledobject -A
kubectl get podautoscaler -A
kubectl describe hpa api

The latter two resource types require their respective CRDs. Test one workload at a time, vary the demand signal, and record desired replicas, ready replicas, latency and errors. A replica count is not a service-level objective.

Workload scaling is not node scaling

All three approaches ultimately require execution capacity. Cluster Autoscaler or Karpenter may provision workers when Pods cannot be scheduled, but their reaction time is separate from application scaling. A virtual node may change where execution happens, not whether the application can satisfy its latency budget.

Separate workload scaling from infrastructure provisioning in your measurements. Record the time from demand to desired replicas, from desired to scheduled Pods and from scheduling to readiness. This identifies the control loop that actually limits response time.

Choose the signal before the tool

Use HPA when a conventional workload needs metric-driven replica adjustment. Use KEDA when externally observable work should activate consumers. Use Knative when the platform should manage request-driven application lifecycle and traffic. They can coexist in one cluster, but each workload needs a clearly defined scaling owner.

In Building a Serverless Platform on Kubernetes with Knative we assemble a small Serving and Eventing platform and observe these lifecycle boundaries directly.

Upstream references

Related Articles

Stay ahead

Get the latest insights.

Insights on cloud, AI and open source — delivered to your inbox.

Email subscriptions are coming soon.