kubernetes-sigs / metrics-server

Scalable and efficient source of container resource metrics for Kubernetes built-in autoscaling pipelines.
https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/
Apache License 2.0
5.72k stars 1.86k forks source link

How to get the "metrics_server_pod_cpu_usage"data #1363

Open mayanshun opened 9 months ago

mayanshun commented 9 months ago

metrics_server v0.5.2 in my cluster K8s v1.25.0 I wan to get the datas "metrics_server_pod_cpu_usage " from prometheus , the prometheus can not search the data

mayanshun commented 9 months ago

curl --cert /etc/kubernetes/pki/apiserver-kubelet-client.crt --key /etc/kubernetes/pki/apiserver-kubelet-client.key -k https://172.16.121.131:6443/metrics this datas have no "metrics_server*"

mayanshun commented 9 months ago

`[root@172-16-104-15 prometheus]# cat prometheus.yml

my global config

global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.

scrape_timeout is set to the global default (10s).

Alertmanager configuration

alerting: alertmanagers:

Load rules once and periodically evaluate them according to the global 'evaluation_interval'.

rule_files:

- "first_rules.yml"

- "second_rules.yml"

A scrape configuration containing exactly one endpoint to scrape:

Here it's Prometheus itself.

scrape_configs:

The job name is added as a label job=<job_name> to any timeseries scraped from this config.

配置k8s API-Server 服务发现

配置namespace下的pod服务发现

指定Pod发现条件

dgrisonnet commented 9 months ago

/assign /triage accepted /kind support