How to upload dashboards as .json files to kubernetes via helm

@gnutakki good to hear it is working! I was also looking into sidecars but for me this added complexity I didn’t want… very glad to have been of some help anyway.

1 Like

@missswapna / @gnutakki Thanks a lot for the help. I managed to get it working using these values: https://raw.githubusercontent.com/guivin/terraform-helm-example/0.1.0/templates/grafana-values.yaml

Hy, i have followed the same method like the above adding a configmap in the same namespace of the json file but the dashboard is not persisting even though what might be the issue.

Hy, i have followed the same method like the above adding a configmap in the same namespace of the Json file but the dashboard is not persisting even though what might be the issue.

can you help this @missswapna @gnutakki

@vallabhanenisai1999 are you able to give more detail on your configuration and also follow the bullet points I posted above to troubleshoot, then will be happy to help. Thanks!

I’m just wondering how you guys manage to load multiple dashboards into Grafana without exceeding the maximum of 1MiB for the ConfigMap size.

Yes I know, we are able to create multiple ConfigMaps but that’s really not a good idea for us because we have lots of dashboards for different teams. For example, Team Alpha has created 5 different dashboards for their specific microservices and we don’t want to create different ConfigMaps for just one team because of that 1MiB maximum size.

1 Like

is there any way to provision dashboards (and alerts) without using k8s-sidecar at all or bypassing it?

1 Like

Yes we have now hit this limit and so are using the kiwigrid sidecar. Its actually not as complicated as I thought to set up, and it can be used for dashboards AND datasources (my initial concern de to that warning in my earlier post). So we use this now;

grafana:
  sidecar:
    dashboards:
      enabled: true
      searchNamespace: 'grafana'
      provider:
        name: sidecarProvider
        orgid: 1
        folder: ''
        type: file
        disableDelete: false
        allowUiUpdates: true
        foldersFromFilesStructure: false
    datasources:
      enabled: true
      label: "grafana_datasource"
      labelValue: ""

And the dashboards are loaded as individual config maps… the datasources as secrets - they must have the respective labels;

grafana_dashboard: "1"
grafana_datasource: "1"

Cheers.

Can i manage the dashboards and which team they are belong to ? i am new and i have already a monitoring stack deployed in k8s cluster i want to manage the dashboards i found in config map provider section an attribut called falder i thought this will be the folder where the dashboards will be found under in the UI then i will manage the permessions. any help ?

Hi have a related problem. It appears that I am unable to create ConfigMaps during helm upgrade
Also, I am running a helm chart, that includes the grafana chart, so maybe there is the problem:

I hope to get some clarification. Some context:

my values.yaml looks as follows:

grafana: 
  sidecar:
    dashboards:
      enabled: true
    datasources:
      enabled: true

I have added a templates folder next to the values.yaml with the following definitions, e.g.:
templates/my-dashboard-cm.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-dashboard-name
  labels:
    grafana_dashboard: "1"
data:
  k8s-dashboard.json: |-
    {
      "annotations": {
        "list": [
          {
            "builtIn": 1,

Using > helm upgrade lgtm-distributed lgtm-distributed/lgtm-distributed -f values.yaml -n lgtm
will deploy grafana but no dashboard.

The description of the created CM reads:

Name:         lgtm-distributed-grafana-config-dashboards
Namespace:    lgtm
Labels:       app.kubernetes.io/instance=lgtm-distributed
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=grafana
              app.kubernetes.io/version=10.4.3
              helm.sh/chart=grafana-7.3.12
Annotations:  meta.helm.sh/release-name: lgtm-distributed
              meta.helm.sh/release-namespace: lgtm

Data
====
provider.yaml:
----
apiVersion: 1
providers:
  - name: 'sidecarProvider'
    orgId: 1
    folder: ''
    type: file
    disableDeletion: false
    allowUiUpdates: false
    updateIntervalSeconds: 30
    options:
      foldersFromFilesStructure: false
      path: /tmp/dashboards

BinaryData
====

Events:  <none>

I would have assumed to get more configmaps.
Are the ConfigMaps in the template-folder consumed during upgrade?
How can I trace the creation of the ConfigMaps?

Also, the dashboards do not appear in the pod:

/usr/share/grafana $ ls /tmp/dashboards/

Have you changed your file structure? As I see, you’ve renamed the ‘dashboards’ folder to ‘grafana-dashboards’. And what is inside of your datasources.yaml file?