How to Deploy Grafana dashboard with side car and group the dashboard with specific dashboards Folder

Viewed 3036

Could you please let me know, How should I deploy a grafana dashboard with sidecar and place/group it in specific dashboard folder?

Example ( Mongo DB dashboard resides in Mongo Folder and Postgres at Postgres Folder). Please note that I am NOT talking about file locations ( /tmp/dashboards ).

I am using the grafana stable HELM chart and latest version of grafana (version 6.4.2)

I am deploying JSON dashboards with k8s configmap and label the config map with sidecar dashboard label. Once deployed it always goes to default "General" dashboards Folder.

HRLM values

  sidecar:
    dashboards:
      enabled: true
      label: grafana_dashboard

THANKS

1 Answers

You can add dashoard Providers to your values file and specify custom configuration for each of your folders.

Example :

dashboardProviders:
dashboardproviders.yaml:
  apiVersion: 1
  providers:
  - name: folder1
    orgId: 1
    type: file
    folder: folder1
    allowUiUpdates: true
    disableDeletion: false
    updateIntervalSeconds: 10
    editable: true
    options:
      path: /tmp/dashboards/folder1
  - name: folder2
    orgId: 2
    type: file
    folder: folder2
    allowUiUpdates: true
    disableDeletion: false
    updateIntervalSeconds: 10
    editable: true
    options:
      path: /tmp/dashboards/folder2
  - name: folder3
    orgId: 3
    type: file
    folder: folder3
    allowUiUpdates: true
    disableDeletion: false
    updateIntervalSeconds: 10
    editable: true
    options:
      path: /tmp/dashboards/folder3

Then you can add an annotation to each of your dashboards configmaps to tell helm chart where to place those dashboards :

k8s-sidecar-target-directory: /tmp/dashboards/folder1

This annotation will tell helm to place the target dashboards under /tmp/dashboards/folder1 so that they can be managed by folder1 provider.

Related