我想在 GKE HPA 上使用自定义日志指标。Metrics 可以在 metrics explorer 上查看,但无法在 HPA 上使用。我们已经安装了自定义指标适配器,并且我们能够使用其他自定义指标,例如kubernetes.io|pod|network|received_bytes_count
成功进行扩展。下图显示了我想在 HPA 上使用的自定义指标的指标资源管理器图
该指标是根据应用程序日志创建的
在 HPA yaml 之后使用以使用该指标
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: "similar-products-rts-hpa"
namespace: relevancy
spec:
behavior:
scaleUp:
stabilizationWindowSeconds: 120
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: similar-products
minReplicas: 3
maxReplicas: 6
metrics:
- type: Pods
pods:
metric:
name: "logging.googleapis.com|user|Similar_Products(RTS)_Inbound_Request_Count"
target:
type: AverageValue
averageValue: 25
请在下面找到错误
The HPA was unable to compute the replica count: unable to get metric logging.googleapis.com|user|Similar_Products(RTS)_Inbound_Request_Count: unable to fetch metrics from custom metrics API: googleapi: Error 400: The supplied filter does not specify a valid combination of metric and monitored resource descriptors. The query will not return any time series., badRequest