How to implment Horizontal Pod Autoscaling on external metrics?

Viewed 65

I want to autoscale pods based on external metric, which is predicted CPU usage. I have an AI module that can predict what the CPU usage for pod will look like for the next 1 minute, based on last 5 minutes. I want HPA to autoscale based on these predictions and not on actual CPU usage. What is the best way to achieve this?

1 Answers

As per my knowledge the best way to achieve this is using KEDA.

KEDA is a single-purpose and lightweight component that can be added into any Kubernetes cluster. KEDA works alongside standard Kubernetes components like the Horizontal Pod Autoscaler and can extend functionality without overwriting or duplication.

Depending on How your external metric is implemented ,you may be able to use an existing keda scaler such as External, predictkube, prometheus

Predictkube ia a AI -based on prometheus metrics and predictkube saas which sounds a lot like the AI module you described in your question.

Using a custom metric adapter is also a way to achieve this, But you will need to push the value to Cloud Logging /pubsub and from there you can use this

Here is the document to implement it.

Related