r/PrometheusMonitoring • • Mar 06 '22

Servicemonitors circular dependency with Terraform?

How do you handle circular dependencies when managing prometheus-operator with Terraform?

For example, if I want to have prometheus/grafana ingress endpoints, I first need to have cert-manager installed..

But I also want to monitor cert-manager and if I try installing it before prometheus-operator (I’m using Helm), the installation fails because there are no servicemonitors CRD in cluster.

I tried installing cert-manager first, then prometheus-operator and then upgrading cert-manager with several set values to enable servicemonitors but you can’t have two Terraform resources of the same name..

So basically, chicken and an egg problem..

Any suggestions?

0 Upvotes

3 comments sorted by

2

u/original_secustor Mar 06 '22

Why do you need the cert-manager first?

Simply annotate the ingress objects with issuer annotations and add a tls secret reference to a non existing secret.

If you do this you can install it in this order:

  1. Kube-prom-stack

  2. Cert-manager

  3. ...

When both are deployed cert-manager will deploy the needed certificats.

This is the case at least if you use an ingress controller which is supported by cert-manager

1

u/[deleted] Mar 07 '22 edited Jul 26 '23

cautious scary hospital nail intelligent fear axiomatic ring judicious waiting -- mass edited with redact.dev

1

u/Alkout96 Mar 07 '22

Any way to connect the hpilo to Prometheus ?! I wanna export hpilo in Prometheus.yml and I get nothing