Reputation: 795
We have components which use the Go library to write status to prometheus, we are able to see the data in Prometheus UI, we have components outside the K8S cluster which need to pull the data from Prometheus , how can I expose this metrics? is there any components which I should use ?
Upvotes: 0
Views: 1542
Reputation: 6853
You may want to check the Federation section of the Prometheus documents.
Federation allows a Prometheus server to scrape selected time series from another Prometheus server. Commonly, it is used to either achieve scalable Prometheus monitoring setups or to pull related metrics from one service's Prometheus into another.
It would require to expose Prometheus service out of the cluster with Ingress or nodePort and configure the Center Prometheus to scrape metrics from the exposed service endpoint. You will have set also some proper authentication. Here`s an example of it.
Second way that comes to my mind is to use Kube-state-metrics
kube-state-metrics is a simple service that listens to the Kubernetes API server and generates metrics about the state of the objects.
Metrics are exported on the HTTP endpoint and designed to be consumed either by Prometheus itself or by scraper that is compatible with Prometheus client endpoints. However this differ from the Metrics Server and generate metrics about the state of Kubernetes objects: node status, node capacity, number of desired replicas, pod status etc.
Upvotes: 1