Dashbord duplicates after migration to the new database backend

  • What Grafana version and what operating system are you using?

    • Grafana: 12.4.0 (also tested / compared with 12.4.2 in one environment).
    • Runtime: Official Grafana container on Kubernetes (Linux nodes).
    • Orchestration: Grafana Operator (grafana.integreatly.org/v1beta1), 2 replicas per deployment.
  • What are you trying to achieve?
    Run Grafana with PostgreSQL as the database, migrate from an existing Bitnami PostgreSQL backend to CloudNativePG (Postgres), and keep dashboards provisioned from ConfigMaps (k8s-sidecar + file provisioning) without duplicate dashboard entries in the UI / DB.

  • How are you trying to achieve it?

    • Point Grafana database.host at the new CNPG read-write service.
    • Keep unchanged dashboard delivery: k8s-sidecar loads labelled ConfigMaps into /var/lib/grafana/dashboards, file dashboard provider with updateIntervalSeconds ~ 60 .
    • Same Grafana 12.4.x image and operator-managed grafana.ini as on the old cluster.
    • Investigating unified storage behavior (rows in resource / resource_history vs legacy dashboard tables) and settings such as enableMigration, autoMigrationThreshold, dualWriterMode.
  • What happened?
    On the old Bitnami-backed database, each provisioned dashboard appears once.

    After switching to the new CNPG database (fresh or empty Grafana schema / new unified-storage state), the same ConfigMap-sourced dashboards often appear 2–3 times (same title, duplicated in browse/search). Duplicates align with provisioning + HA and possibly unified storage on a clean backend.

  • What did you expect to happen?
    Same as before migration: one logical dashboard per provisioned JSON, with idempotent updates on each provisioner run, regardless of 2 replicas or DB being new.
    I am trying to understand why we don’t faced with this issue before, even for dashboards that don’t contains UID in the JSON.

  • Can you copy/paste the configuration(s) that you are having problems with?
    1) Grafana DB in configuration

      database:
      type: postgres
    host: <grafana-application-pgsql-cnpg-cluster-rw>.monitoring.svc.cluster.local:5432
    max_idle_conn: "20"
    max_open_conn: "20"
    

    2) Dashboard provisioning

    apiVersion: 1
    providers:
    - name: configmap-dashboard-provider
        orgId: 1
        type: file
        disableDeletion: true
        updateIntervalSeconds: 60
        allowUiUpdates: false
        options:
           path: /var/lib/grafana/dashboards
           foldersFromFilesStructure: true
    
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No consistent error; issue is duplicate dashboards in browse/search.

  • Did you follow any online instructions? If so, what is the URL?
    Automatic storage migration (Grafana 12.4): Automatic storage migration for small instances | Grafana Labs