Kubernetes 普罗米修斯:在普罗米修斯中未发现pod的公制单位
我目前正在pod内运行metrics服务器。数据正在本地主机9090的pod内发送。我可以通过curl获得吊舱内的数据。对deployment.yaml进行注释是为了获取数据,但我在pod中没有看到任何新的指标。我做错了什么 我在pod中看到的指标:Kubernetes 普罗米修斯:在普罗米修斯中未发现pod的公制单位,kubernetes,prometheus,Kubernetes,Prometheus,我目前正在pod内运行metrics服务器。数据正在本地主机9090的pod内发送。我可以通过curl获得吊舱内的数据。对deployment.yaml进行注释是为了获取数据,但我在pod中没有看到任何新的指标。我做错了什么 我在pod中看到的指标: cpu_usage{process="COMMAND", pid="PID"} %CPU cpu_usage{process="/bin/sh", pid="1"} 0
cpu_usage{process="COMMAND", pid="PID"} %CPU
cpu_usage{process="/bin/sh", pid="1"} 0.0
cpu_usage{process="sh", pid="8"} 0.0
cpu_usage{process="/usr/share/filebeat/bin/filebeat-god", pid="49"} 0.0
cpu_usage{process="/usr/share/filebeat/bin/filebeat", pid="52"} 0.0
cpu_usage{process="php-fpm:", pid="66"} 0.0
cpu_usage{process="php-fpm:", pid="67"} 0.0
cpu_usage{process="php-fpm:", pid="68"} 0.0
cpu_usage{process="nginx:", pid="69"} 0.0
cpu_usage{process="nginx:", pid="70"} 0.0
cpu_usage{process="nginx:", pid="71"} 0.0
cpu_usage{process="/bin/sh", pid="541"} 0.0
cpu_usage{process="bash", pid="556"} 0.0
cpu_usage{process="/bin/sh", pid="1992"} 0.0
cpu_usage{process="ps", pid="1993"} 0.0
cpu_usage{process="/bin/sh", pid="1994"} 0.0
部署.yaml
template:
metadata:
labels:
app: supplier-service
annotations:
prometheus.io/path: /
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
ports:
- containerPort: 80
- containerPort: 443
- containerPort: 9090
普罗米修斯
global:
scrape_interval: 15s # By default, scrape targets every 15seconds. # Attach these labels to any time series or alerts when #communicating with external systems (federation, re$
external_labels:
monitor: 'codelab-monitor'
# Scraping Prometheus itself
scrape_configs:
- job_name: 'prometheus'
scrape_interval: 5s
static_configs:
- targets: ['localhost:9090']
- job_name: 'kubernetes-service-endpoints'
scrape_interval: 5s
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- action: labelmap
regex: __meta_kubernetes_service_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: replace
target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep
regex: true
- source_labels: [__address__]
action: replace
regex: ([^:]+)(?::\d+)?
replacement: $1:9090
target_label: __address__
- source_labels: [__meta_kubernetes_service_name]
action: replace
target_label: kubernetes_name
端口号正确。我做错了什么?您的
kubernetes\u sd\u configs
配置为查找由服务创建的端点。您是否为您的服务创建了端点?您可以使用命名空间中的kubectl get endpoints
进行检查。如果你不想创建一个服务,我想你可以配置普罗米修斯来抓取吊舱目标,查看更多信息
另外,假设度量名称必须匹配正则表达式[a-zA-Z::][a-zA-Z0-9:::]*
,因此度量名称中的破折号(-
)也可能是一个问题。我已根据您提到的规范进行了更新。并更新了主帖子。你能看一下吗?prometheus.yml也会更新。普罗米修斯方面仍然没有指标。有没有命令探测库伯内特斯系统,在那里我可以知道哪些指标是从哪个吊舱发送的?顺便说一句,我没有运行pushgateway或prometheus操作员。。。。只有普罗米修斯和格拉法纳。:-)