By default, kubernetes HPA supports only CPU metrics for pod autoscaling. However, now the autoscaling beta API version has the capability to scale HPA based on memory and other custom metrics.
I have been trying to set this up on GKE (Google Container engine). But I am stuck at HPA part where it is not able to get the custom metrics.
So here is what I did,
- Setup Prometheus operator for custom metrics aggregation.
 - Custom metrics API registration
 - Deployed a pod exposing custom metrics.
 - Setup HPA for scaling using custom metrics. (Getting error here as the HPA is not receiving the custom metrics from the pod.)
 
Also, I see from one blog post that for custom metric scaling, you need to enable --horizontal-pod-auto-scaler-use-rest-clients=true for the kubernetes cluster. So one doubt I have is that, by default in the latest GKE clusters, is it enable?
Following are the resources I used for setting up this on GKE.
- https://blog.openshift.com/kubernetes-1-8-now-custom-metrics/
 - https://github.com/kubeless/kubeless/tree/master/manifests/autoscaling
 - https://docs.bitnami.com/kubernetes/how-to/configure-autoscaling-custom-metrics/
 
Also, I have raised an issue kubeless repo for the same (https://github.com/kubeless/kubeless/issues/493)
