Deploying custom dashboards to Kloudfuse grafana server
Kloudfuse install/upgrade will provision a set of dashboards, this guide is mainly for users who want to deploy their own dashboards to the Kloudfuse grafana instance. This will also ensure that the custom dashboards persist across upgrades.
As a prerequisite, you should’ve run helm pull --untar of Kloudfuse release you wish to install/upgrade. The steps for this are documented in this guide. Once this command is run, the release is usually untarred to a directory called kfuse.
This document will use sock-shop.json as a sample dashboard. This is only an example, you should replace the name in all code snippets with the name of the dashboard you wish to import.
Create a directory called
dashboardsin thekfusedirectory. Copy the dashboard json(s) into this folder. For example, copysock-shop.jsonintokfuse/dashboardsfolder.
Create a template file (of kind
ConfigMap) inkfuse/templatesdirectory. For more information on the structure oftemplatesdirectory, check out this page.# sock-shop-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: sock-shop-dashboard namespace: {{ .Release.Namespace }} data: kloudfuse.json: |- {{ .Files.Get "dashboards/sock-shop.json" | indent 4 }}
You’ll need to create a template file for each dashboard json you wish to import.
Update your custom
values.yamlfile with the custom dashboard(s) as dashboard providers. You’ll need to add it undergrafanasection in the customvalues.yaml. For instance, forsock-shopdashboard you’ll need to updatevalues.yamlas:
# custom_values.yaml
# grafana - Configuration for the embedded Grafana included in Kfuse
grafana:
grafana:
fullnameOverride: "kfuse-grafana"
nameOverride: "kfuse-grafana"
# replicas - Specify the number of Grafana replicas to deploy
replicas: 1
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'sock-shop'
orgId: 1
folder: <folderName>
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards/sock-shop
dashboardsConfigMaps:
sock-shop: sock-shop-dashboard
Ensure that the providers.name, providers.options.path are updated correctly to match the dashboard json you’re importing. providers.folder is an additional option which will install the dashboard in the specified folder. By default, grafana installs all dashboards in General folder.