I want to use the Custom log metrics on GKE HPA. Metrics are able to view on metrics explorer but unable to use it on HPA . We have installed Custom metrics adapter and We are able to use other custom metrics like kubernetes.io|pod|network|received_bytes_count
successfully for scaling. Below image shows the Metrics explorer graph for custom metric that i want to use on HPA
This metric was created from application logs
Used following HPA yaml to use that metric
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
Please find the error below
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