Search code examples
kubernetesprometheus

How to automatically create a Prometheus and Grafana instance inside every new K8s namespace


I am trying to analyse on how to deploy Prometheus and Grafana instance automatically inside every new namespace that is created inside a Kubernetes cluster to achieve multi-tenancy.

I checked prometheus-operator, but this seems to allow only to create configuration for targets which need to scraped. How can i achieve my usecase? Are there are any tools which can help here?


Solution

  • You may want to consider a multi-tenant operator approach on which you develop a custom operator that creates separate CRDs for Prometheus and Grafana, allowing configurations specific to namespace. You should leverage frameworks like Operator SDk or KUDO to simplify operator development. It may just requires more development effort and expertise compared to using existing tools.

    You can try managed services like Thanos for Prometheus and Grafana Cloud for multi-tenancy capabilities. These services offer features like namespace isolation and self-service access control. These might incur additional cost and vendor lock-in.