Elasti works seamlessly with Horizontal Pod Autoscaler (HPA) and handles scaling to zero on its own. Since Elasti manages the scale-to-zero functionality, you can configure HPA to handle scaling based on metrics for any number of replicas greater than zero, while Elasti takes care of scaling to/from zero.
A setup is explained in the getting started guide.
Elasti takes care of scaling up and down a service when there is some traffic. KEDA is a good candidate for performing the scaling logic for the service from minReplicas to maxReplicas based on it’s triggers.
Here we will see how to integrate Elasti with KEDA to build a complete scaling solution.
Let’s create a keda scaler for the httpbin service.
kubectl apply -f ./playground/config/ demo-application-keda.yaml
Note that the same prometheus query is used as in the getting started guide for ElastiService and the namespace is the same as the namespace that the ElastiService is created in.
Refer to the keda documentation for more details on configuring the ScaledObject.
We will update the ElastiService to specify the keda scaler to work with. We will add the following fields to the ElastiService object:
spec:
autoscaler:
name: httpbin-scaled-object
type: keda
Patch the ElastiService object with the above changes.
kubectl patch elastiservice httpbin -n elasti-demo -p '{"spec":{"autoscaler":{"name": "httpbin-scaled-object", "type": "keda"}}}' --type=merge
Now when elasti scales down the service, it will pause the keda ScaledObject to prevent it from scaling up the service again, and when elasti scales up the service, it will resume the ScaledObject.
With these changes, elasti can reliably scale up the service when there is traffic and scale down the service to zero when there is no traffic while keda can handle the scaling logic for the service from minReplicas to maxReplicas based on it’s triggers.