Manage Multiple Grafana Instances and Dashboards on Kubernetes with the Grafana Operator


Grafana is a popular open source application typically used for data analysis. It allows administrators great flexibility in monitoring, querying and visualizing metrics from running applications and services in real time. It supports custom dashboards, 30+ data sources and integrations with many other tools.

To make it easy to deploy Grafana in production Kubernetes environments, Bitnami offers two Helm charts:

This tutorial focuses on Bitnami's Grafana Operator Helm chart. This Helm chart allows cluster administrators to easily deploy multiple Grafana instances, dashboards and data sources. It is also easily configurable, up-to-date and follows best practices for security and scalability.

Assumptions and prerequisites

This tutorial demonstrates how to use the Grafana Operator to deploy a Grafana instance on a Kubernetes cluster. It then uses the Grafana Operator to add a custom GitHub dashboard to the Grafana instance and configures a GitHub data source for the new dashboard. It assumes that:


As the Grafana Operator automatically deploys Grafana installations, the Grafana Operator pods will require a Kubernetes service account with privileges to create and destroy multiple Kubernetes objects. This may not work for Kubernetes clusters with strict role-based access policies.

Step 1: Deploy the Grafana Operator on Kubernetes

The first step is to deploy the Grafana Operator on Kubernetes using Bitnami's Helm chart.

helm repo add bitnami
helm install grop bitnami/grafana-operator --set grafana.enabled=false

This command deploys the Grafana Operator on Kubernetes. By default, it also creates a Grafana deployment. However, in this tutorial, the default behaviour is deliberately disabled so that the process of creating a Grafana deployment using the Grafana Operator can be explained in detail (in the next step).

Step 2: Use the Grafana Operator to deploy a Grafana instance

Once the Grafana Operator is deployed, the next step is to create and install a new Grafana deployment on the cluster.

  • Create the following Kubernetes manifest file and save it as grafana.yml. Replace the GRAFANA-PASSWORD placeholder with a password for the Grafana administrator account.

    kind: Grafana
      name: mygrafana
        type: LoadBalancer
        enabled: False
          mode: "console"
          level: "warn"
          admin_user: "admin"
          admin_password: "GRAFANA-PASSWORD"
          enabled: True
        - matchExpressions:
            - { key: app, operator: In, values: [grafana] }

    This manifest file defines a new Grafana deployment using the Grafana Operator's Grafana resource definition. In particular, it configures a load balancer service for the new Grafana instance and defines the administrator credentials.


    A number of other parameters are also available for Grafana configuration and are defined in the Grafana Operator specification for the Grafana resource.

  • Apply the changes to the cluster:

    kubectl apply -f grafana.yml

    A new Grafana deployment is initialized on the cluster.

  • Wait until the deployment is complete and then obtain the public IP address for the load balancer:

    kubectl get svc | grep grafana
  • Navigate to http://IP-ADDRESS:3000/ with your browser, replacing the IP address placeholder with the public load balancer IP address, and confirm that you see the Grafana welcome page, as shown below:

Grafana welcome page

Step 3: Use the Grafana Operator to deploy a Grafana dashboard

Next, use the Grafana Operator to install a new Grafana dashboard in the Grafana instance.

  • Create the following Kubernetes manifest file and save it as grafana-dashboard.yml:

    kind: GrafanaDashboard
      name: mydashboard
        app: mygrafana
        - name: "grafana-github-datasource"
          version: "1.0.6"
        - inputName: "DS_GITHUB"
          datasourceName: "GitHub"

    This manifest file defines a new Grafana dashboard using the Grafana Operator's GrafanaDashboard resource definition. In this case, the dashboard specification contains three important properties:

    • The dashboard's JSON model is defined either with the url or json properties. This tutorial uses the sample GitHub dashboard JSON model provided by the Grafana GitHub plugin which expects an input data source named DS_GITHUB. For convenience, the url property is used to retrieve the dashboard JSON directly from its source repository, but it could alternatively have been specified inline via the json property.
    • The plugins property defines the plugins required by the dashboard. This tutorial uses the Grafana GitHub plugin.
    • The datasources property defines the data sources used by the dashboard. The inputName for the data source (DS_GITHUB in this case) must directly map to an expected input in the dashboard JSON model.

    A number of other parameters are also available for configuration and are defined in the Grafana Operator specification for the GrafanaDashboard resource.

  • Apply the changes to the cluster:

    kubectl apply -f grafana-dashboard.yml

The existing Grafana instance is redeployed with the additional dashboard. As specified in the JSON model, this dashboard is named "GitHub Default".

Step 4: Configure a data source for the Grafana dashboard

Every dashboard created in Grafana requires a data source. In most cases, this can be done by using the Grafana Operator to create a GrafanaDataSource resource, in the same way as the previous Grafana and GrafanaDashboard resources were created.

However, at the time of writing, it is not possible to create the GitHub data source using the Grafana Operator due to technical limitations. Therefore, the GitHub data source needed by the dashboard created in the previous step has to be configured via the Grafana user interface, as described below:

  • Navigate to the Grafana welcome page at http://IP-ADDRESS:3000/, replacing the IP address placeholder with the public load balancer IP address.
  • Click the "Sign In" link in the bottom left corner.
  • Log in to Grafana with the user name admin and the password defined in Step 1.
  • Navigate to the "Configuration -> Data Sources" menu item.
  • Click the "Add data source button".
  • Search for and select the "GitHub" data source.
Add data source
  • On the data source "Settings" page, reconfirm that your GitHub access token has the necessary permissions and enter it in the "Access Token" field.
Configure data source
  • Click the "Save and Test" button.

If the test is successful, the GitHub data source is now configured.

Step 5: Test the Grafana dashboard

You can now test the Grafana dashboard, as follows:

  • Navigate to the "Dashboard -> Manage" menu item.
  • Select the "default" folder.
  • Select the "GitHub Default" dashboard. The GitHub dashboard should appear.
Dashboard selection

You will notice that the GitHub dashboard is already connected to the GitHub data source. This is due to the datasources configuration provided in the GrafanaDashboard resource.

  • Use the "Organization", "Repository" and "Branch" filters in the dashboard to select a different GitHub organization and repository. The dashboard will automatically update to reflect the latest statistics for the selected organization, repository and branch, as shown below:
Dashboard operation

This demonstrates that the GitHub dashboard created through the Grafana Operator is functioning correctly. In a similar manner, it is possible to create additional Grafana instances and dashboards via the Grafana Operator using Kubernetes manifest files.

Useful links

To learn more about the topics discussed in this guide, use the links below: