I have been pondering around this question for a while now, we are running a similar setup to what you describe below (in-cluster Prometheus with short retention scraped by two out-of-cluster Prometheus servers with week worth of retention) but in fact I feel we are over extending the use of federation to something it was not meant to cover, for now it's OK - but I fear things will get ugly when we scale.
We have several reasons for wanting to run Prometheus servers on dedicated nodes outside the K8s cluster and I have been looking into several way to achieve that.
1) Using some kind of a proxy - ruled out as unreliable (I see you have made the same conclusion)
2) This one is tricky and I'm hoping to have some time to PoC it soon, but will require the following:
- Extend the K8s overlay network (flannel in our case) to the out-of-cluster Prometheus servers - thus achieving access to Pod IPs
- Side-effect: we will "lose" two subnets from flannel's range (minor concern for us)
- Accessing the K8s API Servers from outside the cluster should be doable as well
- We don't need access to "service-cluster-ip-range" since Prometheus needs the endpoints (Pod IPs) and doesn't actually access the Service ClusterIPs
- Access to K8s SD (i.e. DNS service), not sure yet how to approach this exactly, but should be able to figure something out
Any comments/feedback/suggestions ?
Danny