How to provision a dashboard from grafana.com/dashboards when deploying Grafana using the Helm chart?

Hello,

I am deploying Grafana into a Kubernetes cluster using the official Helm chart. I am trying add this dashboard by setting up my own values in my own values files like so:

dashboards:
  default:
    mariadb:
      gnetId: 7362
      datasource: Prometheus

I configured the Prometheus datasources and I can see it is working correctly as I can retrieve metrics using the “Explore” function. I can’t see any errors being reported in the Grafana logs (level set to “info”).

If anyone could give me a hand, that would be great!

Hi @ftriboix,

Is the dashboard getting provisioned but it’s broken, or is the dashboard not getting provisioned at all?

Hi @mattabrams . I can’t find the dashboard in Grafana, so I guess the dashboard is not provisioned at all.

BTW, I can import the dashboard once Grafana is started using the dashboard id.

Have you checked any of the logs, like the deployment logs, or described any of the pods? Can you find any related error messages?

Hi @mattabrams . Yes, I have. The logs don’t show anything related to pulling or installing the dashboard whatsoever. I can see a couple of logs messages about the two sources I added in the values file (Loki and Prometheus). kubectl describe also doesn’t show any problem.

Should I infer from your comments that the syntax of my values file is correct?

Hi @ftriboix,

Can you share your entires values.yaml and any more details about your configuration and deployment? If this is your entire values.yaml then you might be missing some elements.

Somebody just shared their own values.yaml on Grafana’s community Slack the other day. Might be worth comparing notes?

Hi @mattabrams

Here is my values.yaml file:

# Values file for the Grafana helm chart located
# [here](https://github.com/grafana/helm-charts/tree/main/charts/grafana).

# The Grafana helm chart doesn't define an `app` label
podLabels:
  app: grafana

resources:
  requests:
    cpu: 10m
    memory: 10Mi
  limits:
    cpu: 100m
    memory: 128Mi

adminUser: admin
adminPassword: admin

service:
  type: NodePort
  nodePort: 30000

# Static datasources
datasources:
  datasources.yaml:
    apiVersion: 1
    datasources:
      - name: Loki
        type: loki
        access: proxy
        url: http://loki.observability:3100
        jsonData:
          maxLines: 1000
      - name: Prometheus
        type: prometheus
        access: proxy
        url: http://prometheus-server.observability:80
        # TODO
        #jsonData:
        #  exemplarTraceIdDestinations:
        #    - datasourceUid: jaeger
        #      name: traceID

dashboards:
  default:
    mariadb:
      gnetId: 7362
      version: 5
      datasource: Prometheus
    mariadbx:
      url: https://grafana.com/api/dashboards/7362/revisions/5/download

In terms of deployment, Loki, Prometheus and Grafana are deployed using their respective official Helm charts in the observability namespace. I deploy MariaDB in the default namespace. Again, once the Grafana pod is up and running and I access the Grafana UI, I can import the dashboard using its id and the dashboard works fine.

I don’t have access to grafana.slack.com. Where can I get an invite?

Many thanks

Out of desperation, I tried adding the dashboard JSON directly in the values files like so:

dashboards:
  default:
    mariadb:
      gnetId: 7362
      version: 5
      datasource: Prometheus
    mariadbx:
      url: https://grafana.com/api/dashboards/7362/revisions/5/download

    mariadby:
      json: |
        {
          "__inputs": [
            {
              "name": "DS_PROMETHEUS",
              "label": "prometheus",
              "description": "",
              "type": "datasource",
...

I can’t see any dashboard in Grafana, and again nothing in the logs. It looks like this dashboards setting in my values.yaml is simply ignored…

Now I tried using sidecar for dashboards and created a configmap with a copy/paste of the dashboard JSON. Now I can see the dashboard in Grafana! However, nothing shows up and the Grafana UI shows me a couple of errors:

Failed to upgrade legacy queries Datasource named ${DS_PROMETHEUS} was not found

and

Error updating options: Datasource named ${DS_PROMETHEUS} was not found

I am quite new to Grafana, what is the meaning of those messages?

@mattabrams I just realized some of my posts are hidden because the “community” considers they are spam or advertisement. It seems that when I include links to say, github or grafana.com, my posts are flagged and hidden. The messages I get say that I can edit the post after 10 minutes and it will be unhidden, but that is not the case. Could you please help me? Thank you

OK, I finally found what I needed to do. I needed to add a dashboard providers section in my values.yaml file, like so:

dashboardProviders:
  dashboardproviders.yaml:
    apiVersion: 1
    providers:
      - name: default
        orgId: 1
        folder: ""
        type: file
        disableDeletion: false
        editable: false
        options:
          path: /var/lib/grafana/dashboards/default
1 Like

Hi @ftriboix,

So glad it’s working!

It works, but there is a difference between doing this provisioning with a helm config vs importing from the UI.
Particularly, not all of the provisioned dashboards work this way, e.g. provisioning the dashboard called “AWS ELB Application Load Balancer” (gnetId: 650) results in a non-functioning dashboard.
However, importing the same dashboard ID 650 by using the web-UI import feature results in a working dashboard.
The problem is that the provisioned dashboard does not pick up the datasource even though it’s specified in a helm values:

grafana:
  datasources:
    datasources.yaml:
      apiVersion: 1
      datasources:
      - name: CloudWatch
        type: cloudwatch
        jsonData:
          authType: default
          defaultRegion: ${region}
  dashboards:
    default:
      amazon-alb:
        gnetId: 650
        datasource: CloudWatch
  dashboardProviders:
    dashboardproviders.yaml:
      apiVersion: 1
      providers:
      - name: 'default'
        orgId: 1
        folder: ''
        type: file
        disableDeletion: false
        editable: true
        options:
          path: /var/lib/grafana/dashboards/default