<p>I have a helm chart that deploys a kube-prometheus stack (prometheus, grafana, node-exporter), there are some json files (dashboards) in the grafana configuration, they are transferred to the grafana pod via configMap (common practice). I have a task to optimize this configuration to add grafana dashboards via their id from grafana.com and not to use json files (as they are very big). I know how to create a folder in grafana and specify the prometheus resource, but I don't understand how to export dashboards by id.</p>
<p>To create a folder I have a file (yaml) which is added via configmap to the directory /etc/grafana/provisioning/dashboards</p>
<pre><code>- name: 'default'
  org_id: 1
  folder: 'my-dashboards'
  type: 'file'
  options:
    folder: '/var/lib/grafana/dashboards'
</code></pre>
<p>How to do it and in which file I need to insert this configuration to make it work. I will be grateful for help.</p>
<p>I tried to create configurations I found on github (dashboardProviders), but it only creates a folder (the code I specified), without dashboards</p>
<p>UPD: what i have now</p>
<pre><code>apiVersion: 1
providers:
  # &lt;string&gt; an unique provider name. Required
  - name: 'prometheus'
    # &lt;int&gt; Org id. Default to 1
    orgId: 1
    # &lt;string&gt; name of the dashboard folder.
    folder: 'my-dashboards'
    # &lt;string&gt; folder UID. will be automatically generated if not specified
    folderUid: ''
    # &lt;string&gt; provider type. Default to 'file'
    type: file
    # &lt;bool&gt; disable dashboard deletion
    disableDeletion: false
    # &lt;int&gt; how often Grafana will scan for changed dashboards
    updateIntervalSeconds: 10
    # &lt;bool&gt; allow updating provisioned dashboards from the UI
    allowUiUpdates: false
    options:
      # &lt;string, required&gt; path to dashboard files on disk. Required when using the 'file' type
      path: /var/lib/grafana/dashboards
      # &lt;bool&gt; use folder names from filesystem to create folders in Grafana
      foldersFromFilesStructure: true

dashboards:
  default:
    MinIO:
      gnetId: 13502
      revision: 2
      datasource: prometheus

</code></pre>
<p>but it still doesn't work...why?</p>

kose1n
<p>It is (or can be) a part of the <a href="https://github.com/grafana/helm-charts/tree/grafana-6.52.9/charts/grafana" rel="nofollow noreferrer">grafana helm chart</a>, from what I remember when used it in the past. That configuration needs to go into the <code>values.yaml</code> when using that helm chart.</p>
<p>Specifically <a href="https://github.com/grafana/helm-charts/blob/grafana-6.52.9/charts/grafana/values.yaml#L636" rel="nofollow noreferrer">here</a> to enable/configure <code>dashboardProviders</code> and <a href="https://github.com/grafana/helm-charts/blob/grafana-6.52.9/charts/grafana/values.yaml#L655" rel="nofollow noreferrer">here</a> to provision the <code>dashboard</code> using <code>dashboard id</code> from the grafana website.</p>
<p>Can also refer to some documentation <a href="https://github.com/grafana/helm-charts/tree/grafana-6.52.9/charts/grafana#import-dashboards" rel="nofollow noreferrer">here</a>.</p>
<p>Hope it helps.</p>
<p>Update:</p>
<p>Using the below config I was able to import the MinIO Dashboard (the one OP tried to import):</p>
<pre><code>dashboardProviders:
  dashboardproviders.yaml:
   apiVersion: 1
   providers:
   - name: 'default'
     orgId: 1
     folder: 'default'
     type: file
     disableDeletion: true
     editable: true
     options:
       path: /var/lib/grafana/dashboards/standard

dashboards:
  default:
    MinIO:
      gnetId: 13502
      revision: 2
      datasource: prometheus
</code></pre>
<p><a href="https://i.stack.imgur.com/JsppQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JsppQ.png" alt="enter image description here" /></a></p>
<p>Ofcourse I don't have the prometheus data source, hence the warning sign(s).</p>
