<p>I have several k8s clusters and I would like to monitor pods metrics (cpu/memory mainly). 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.</p>
<p>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. I don't want that since I already have prometheus/grafana running somewhere else. I just want to &quot;export&quot; metrics.</p>
<p>I have metrics-servers installed on each clusters but I'm not sure if I need to deploy something else. Please advise me.</p>
<p>So, how can I export my pods metrics to my prometheus/grafana instance?</p>
<p>Thanks</p>

<p>Posting the answer as a community wiki, feel free to edit and expand.</p>
<hr />
<p>You need to use <code>federation</code> for prometheus for this purpose.</p>
<blockquote>
<p>Federation allows a Prometheus server to scrape selected time series
from another Prometheus server.</p>
</blockquote>
<p>Main idea of using <code>federation</code> is:</p>
<blockquote>
<p>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. By configuring and using
federation, Prometheus servers can scrape selected time series data
from other Prometheus servers</p>
</blockquote>
<p>See example <a href="https://banzaicloud.com/blog/prometheus-federation/" rel="nofollow noreferrer">here</a>.</p>
