kubernetes-sigs / prometheus-adapter

An implementation of the custom.metrics.k8s.io API using Prometheus
Apache License 2.0
1.9k stars 551 forks source link

Metrics API for resource metrics not registered by prometheus-adapter #588

Open yashwanth-mannem opened 1 year ago

yashwanth-mannem commented 1 year ago

What happened?:

I have deployed the prometheus-adapter using the helm chart "prometheus-adapter" version 2.6.2. However, I noticed that the metrics API for resource metrics (v1beta1.metrics.k8s.io) is not registered in the Kubernetes cluster.

What did you expect to happen?:

I expected the prometheus-adapter to register the metrics API for resource metrics (v1beta1.metrics.k8s.io) in the Kubernetes cluster.

Please provide the prometheus-adapter config:

prometheus-adapter config apiVersion: v1 data: config.yaml: | resourceRules: cpu: containerLabel: container containerQuery: | sum by (<<.GroupBy>>) ( irate ( container_cpu_usage_seconds_total{<<.LabelMatchers>>,container!="",pod!=""}[120s] ) ) nodeQuery: | sum by (<<.GroupBy>>) ( 1 - irate( node_cpu_seconds_total{mode="idle"}[60s] ) ) or sum by (<<.GroupBy>>) ( node:windows_node_cpu_utilisation:avg5m{mode="idle",job="wmi-exporter",<<.LabelMatchers>>} ) resources: overrides: instance: resource: node namespace: resource: namespace pod: resource: pod memory: containerLabel: container containerQuery: | sum by (<<.GroupBy>>) ( container_memory_working_set_bytes{<<.LabelMatchers>>,container!="",pod!=""} ) nodeQuery: | sum by (<<.GroupBy>>) ( node_memory_MemTotal_bytes{job="node-exporter",<<.LabelMatchers>>} - node_memory_MemAvailable_bytes{job="node-exporter",<<.LabelMatchers>>} ) or sum by (<<.GroupBy>>) ( node:windows_node_memory_utilization{job="wmi-exporter",<<.LabelMatchers>>} ) resources: overrides: instance: resource: node namespace: resource: namespace pod: resource: pod window: 5m kind: ConfigMap

Please provide the HPA resource used for autoscaling:

HPA yaml ``` Not using HPA; I am trying to pull resource metrics using kubectl top nodes, and I see error: Metrics API not available ```

Please provide the HPA status:

[NA]

Please provide the prometheus-adapter logs with -v=6 around the time the issue happened:

prometheus-adapter logs ``` There are no errors, warnings in the logs ```

Anything else we need to know?:

Verified the correctness of the prometheus-adapter configuration. Inspected the prometheus-adapter logs with -v=6 around the time the issue occurred. Validated all the manifests and resources related to prometheus-adapter deployment. Verified the version of prometheus-adapter and prometheus. Considered any other relevant information that might help in resolving the issue.

Environment:

dgrisonnet commented 1 year ago

/kind support /triage accepted /assign

k8s-triage-robot commented 2 months ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted