Create Prometheus datasources dynamically

Hi,

I am deploying Grafana as part of the prometheus-operator helm chart.

I understand that Grafana allows the possibility to add datasources via the sidecar init container in its helm script (https://github.com/helm/charts/tree/master/stable/grafana#sidecar-for-datasources)

However this only works if the secrets are created prior to deploying the grafana (prometheus operator), meaning I need to know all the potential application deployments prior to installing the prometheus-operator, which for my use-case I do not.

Iā€™d like to be able to deploy grafana as part of the prometheus-operator and use that grafana instance for all monitoring and alerting while still being able to dynamically and programmatically add datasources for each Prometheus instance after they have been created via the prometheus-operator.

What is the best way to achieve this?

Thanks,
Sean.

1 Like