knative / serving

Kubernetes-based, scale-to-zero, request-driven compute
https://knative.dev/docs/serving/
Apache License 2.0
5.55k stars 1.16k forks source link

Could autoscaler support multiple metrics simultaneously? #11389

Closed cheimu closed 3 years ago

cheimu commented 3 years ago

/area autoscale

Ask your question here:

When creating a service, I know I have to add autoscaling.knative.dev/class and autoscaling.knative.dev/metric in Service.Spec.ConfigurationSpec.Template.ObjectMeta.Annotations. However, since annotation field is a map[string]string and same key can only have one value. So my question is how could I support both hpa, and kpa at same time? I mean I would like to have both rps and cpu as my autoscaling metrics without using writing my own scaling controller.

Thank you in advance :)

cheimu commented 3 years ago

/area autoscale

zhaojizhuang commented 3 years ago

So my question is how could I support both hpa, and kpa at same time?

@cheimu No, you can't,so far for now. For rps is controlled by autoscaller in Knative(CR:KPA), while cpu is controlled by autoscaller in k8s (CR:HPA,which will be created by autoscaller in Knative). They can’t work togather at the same time.(For example, HPA wants 3 replicas, but B wants 4 replicas. )

So, Unless you write your own autoscaller and your own annotations which is diferrent from annotations in Knative.

cheimu commented 3 years ago

@zhaojizhuang Thank you