Reputation: 1975
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.
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 "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?
Thanks
Upvotes: 2
Views: 2430
Reputation: 4181
Posting the answer as a community wiki, feel free to edit and expand.
You need to use federation
for prometheus for this purpose.
Federation allows a Prometheus server to scrape selected time series from another Prometheus server.
Main idea of using federation
is:
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
See example here.
Upvotes: 4