githubEdit

KEDA Autoscaling example

This notebook shows how you can scale Seldon Deployments based on Prometheus metrics via KEDA.

KEDAarrow-up-right is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed.

With the support of KEDA in Seldon, you can scale your seldon deployments with any scalers listed herearrow-up-right. In this example we will scale the seldon deployment with Prometheus metrics as an example.

Install Seldon Core

Install Seldon Core as described in docsarrow-up-right

Make sure add --set keda.enabled=true

Install Prometheus

!kubectl create namespace seldon-monitoring
!helm upgrade --install seldon-monitoring kube-prometheus-stack \
    --version 44.4.1 \
    --set fullnameOverride=seldon-monitoring \
    --namespace seldon-monitoring \
    --repo https://prometheus-community.github.io/helm-charts/ \
    --wait
Error from server (AlreadyExists): namespaces "seldon-monitoring" already exists
Release "seldon-monitoring" has been upgraded. Happy Helming!
NAME: seldon-monitoring
LAST DEPLOYED: Thu Dec  4 11:20:53 2025
NAMESPACE: seldon-monitoring
STATUS: deployed
REVISION: 2
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
  kubectl --namespace seldon-monitoring get pods -l "release=seldon-monitoring"

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.

Install KEDA

Follow the docs for KEDAarrow-up-right to install.

Create model with KEDA

To create a model with KEDA autoscaling you just need to add a KEDA spec referring in the Deployment, e.g.:

The full SeldonDeployment spec is shown below.

Create Load

We label some nodes for the loadtester. We attempt the first two as for Kind the first node shown will be the master.

Before add loads to the model, there is only one replica

After a few mins you should see the deployment scaled to 5 replicas

Remove Load

After 5-10 mins you should see the deployment replica number decrease to 1

Cleanup

Last updated

Was this helpful?