the server could not find the metric <metrics-name> for services for HPA
balajir24 opened this issue · comments
Hi, we want to create hpa based on custom metrics for azure storage queue count. I have configured Prometheus adapter and getting below response
kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1"
{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"custom.metrics.k8s.io/v1beta1","resources":[{"name":"jobs.batch/azure_queue_count","singularName":"","namespaced":true,"kind":"MetricValueList","verbs":["get"]}]}
Prometheus adapter Configuration:
prometheus:
url: http://prom.monitoring.svc.cluster.local
port: 80
rules:
default: false
custom:
- seriesQuery: '{__name__=~"^messages_total$"}'
resources:
template: <<.Resource>>
name:
#matches: ^(.*)
matches: ^(.*)
as: "azure_queue_count"
metricsQuery: messages_total{account_name="test",job="azure-svc-pushgateway",queue_name="test-jobs",resource_group="test-staging"}
and configured HPA. But HPA is not working and below is the error.
unable to fetch metrics from custom metrics API: the server could not find the metric azure_queue_count for pods
HPA configuration
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: test-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: test-executor
minReplicas: 1
maxReplicas: 2
metrics:
- type: Object
object:
target:
kind: Service
name: test-executor
metricName: azure_queue_count
targetValue: "2"
please suggest on this.
Thanks in advance.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
Hi, @balajir24 - support is not available in this repo, but you may want to look at https://github.com/kubernetes-sigs/prometheus-adapter#configuration and ask in that repo if that doesn't answer your question.