[英]Export kubernetes pods metrics to external prometheus
I have several k8s clusters and I would like to monitor pods metrics (cpu/memory mainly).我有几个 k8s 集群,我想监控 pod 指标(主要是 cpu/内存)。 For that, I already have one central instance of prometheus/grafana and I want to use it to monitor pods metrics from all my podsk8s clusters.
为此,我已经有一个 prometheus/grafana 的中央实例,我想用它来监控我所有 podsk8s 集群的 pod 指标。
Sorry if the question was already asked by I already read lots of tutorials but it's always to install a dedicated prometheus/grafana instance on the cluster itself.抱歉,如果我已经阅读了很多教程,但它总是在集群本身上安装一个专用的 prometheus/grafana 实例,那么我已经提出了这个问题。 I don't want that since I already have prometheus/grafana running somewhere else.
我不希望这样,因为我已经在其他地方运行了 prometheus/grafana。 I just want to "export" metrics.
我只想“导出”指标。
I have metrics-servers installed on each clusters but I'm not sure if I need to deploy something else.我在每个集群上都安装了度量服务器,但我不确定是否需要部署其他东西。 Please advise me.
请给我提意见。
So, how can I export my pods metrics to my prometheus/grafana instance?那么,如何将我的 pod 指标导出到我的 prometheus/grafana 实例?
Thanks谢谢
Posting the answer as a community wiki, feel free to edit and expand.将答案发布为社区 wiki,随时编辑和扩展。
You need to use federation
for prometheus for this purpose.为此,您需要使用
federation
for prometheus。
Federation allows a Prometheus server to scrape selected time series from another Prometheus server.
联合允许 Prometheus 服务器从另一个 Prometheus 服务器抓取选定的时间序列。
Main idea of using federation
is:使用
federation
的主要思想是:
Prometheus is a very flexible monitoring solution wherein each Prometheus server is able to act as a target for another Prometheus server in a highly-available, secure way.
Prometheus 是一个非常灵活的监控解决方案,其中每个 Prometheus 服务器都能够以高可用性、安全的方式充当另一个 Prometheus 服务器的目标。 By configuring and using federation, Prometheus servers can scrape selected time series data from other Prometheus servers
通过配置和使用联邦,Prometheus 服务器可以从其他 Prometheus 服务器中抓取选定的时间序列数据
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.