Grafana Dashboards for use with Zero to JupyterHub on Kubernetes
Grafana dashboards displaying prometheus metrics are extremely useful in diagnosing issues on Kubernetes clusters running JupyterHub. However, everyone has to build their own dashboards - there isn't an easy way to standardize them across many clusters run by many entities.
This project provides some standard Grafana Dashboards as Code to help with this. It uses jsonnet and grafonnet to generate dashboards completely via code. This can then be deployed on any Grafana instance!
-
Locally, you need to have jsonnet installed. The grafonnet library is already vendored in, using jsonnet-builder.
-
A recent version of prometheus installed on your cluster. Currently, it is assumed that your prometheus instance is installed using the prometheus helm chart, with kube-state-metrics, node-exporter and cadvisor enabled. In addition, you should scrape metrics from the hub instance as well.
-
A recent version of Grafana, with a prometheus data source already added.
-
An API key with 'editor' permissions. This is per-organization, and you can make a new one by going to the configuration pane for your Grafana (the gear icon on the left bar), and selecting 'API Keys'.
There's a helper deploy.py
script that can deploy the dashboard to any grafana installation.
export GRAFANA_TOKEN="<API-TOKEN-FOR-YOUR-GRAFANA>
./deploy.py <url-to-your-grafana-install> jupyterhub.jsonnet
This should create a dashboard called 'JupyterHub Dashboard' in your grafana installation!
Grafana doesn't populate the 'hub' variable properly by default. You'll need to:
- Go to your Dashboard
- Go to settings (gear icon in top right)
- Select the 'hub' variable
- Click the 'Update' button
This will show you the hubs on your cluster, and then you can select them from the dropdown. Unfortunately, right now there seem to be no easy way to automatically update these.
NOTE: ANY CHANGES YOU MAKE VIA THE GRAFANA UI WILL BE OVERWRITTEN NEXT TIME YOU RUN deploy.py. TO MAKE CHANGES, EDIT THE JSONNET FILE AND DEPLOY AGAIN