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

Unable to get interface metrics #585

Open Cairry opened 1 year ago

Cairry commented 1 year ago

I deployed the prometheus-adapter service, and pointed to my prometheus service, obtained the interface information by getting the command, could not find the data I wanted, and could not configure HPA. root@node1:/opt# kubectl get --raw "/apis/custom.metrics.k8s.io/v1beta1" | jq . { "kind": "APIResourceList", "apiVersion": "v1", "groupVersion": "custom.metrics.k8s.io/v1beta1", "resources": [] }

`rules: default: false custom:

prometheus: url: http://prometheus-prometheus-oper-prometheus.monitoring.svc port: 9090`

image
logicalhan commented 1 year ago

/triage accepted /assign @dgrisonnet /type support

houn27 commented 1 year ago

come across the same problem. when i rewrote the default deply/manifests/config-map.yaml as :

apiVersion: v1
data:
  config.yaml: |-
    "rules":
    - "seriesQuery": |
         {namespace!="",__name__!~"^container_.*"}
      "resources":
        "template": "<<.Resource>>"
      "name":
        "matches": "^(.*)_total"
        "as": ""
      "metricsQuery": |
        sum by (<<.GroupBy>>) (
          irate (
            <<.Series>>{<<.LabelMatchers>>}[1m]
          )
        )
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/component: metrics-adapter
    app.kubernetes.io/name: prometheus-adapter
    app.kubernetes.io/version: 0.10.0
  name: adapter-config
  namespace: monitoring

i can't get access to the adapter api as a result:

kubectl get --raw /apis/metrics.k8s.io/v1beta1 
Error from server (NotFound): the server could not find the requested resource.

Why can the "resourceRules" work? rather than "rules".

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