Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This page describes

...

how you can set up Grafana on your cluster to help visualize the metrics retrieved by the Prometheus server.

It also contains example dashboards both as zip and yaml-files that you can download with these links:

...

...

On Private Cloud and AWS

...

The steps for installing the Grafana tool using helm, as well as how to integrate it with

...

your Usage Engine deployment, are described in this section. Before

...

proceeding, see information on how to install Grafana using helm

...

at https://github.com/grafana/helm-charts/tree/main/charts/grafana.

Before

...

you install Grafana, it is recommended that you install the Prometheus server

...

, see Setting up Prometheus(4.1)

...

.

...

...

titleNote!

...

The procedure described below is just one of many ways to install Grafana. The example provided uses the helm charts to install Grafana. However, you can install Grafana using any method you want.

title
Note

Note!

If you have installed your Prometheus server in its own namespace, make sure ensure that Grafana has access to the Prometheus server.

Installing Grafana without Persistence

The following steps show describe how to you install Grafana without the use of persistence. This means , meaning that if your deployment is brought goes down, the data is not retained. We do not recommend deploying Grafana without persistence in a production environment.

  1. Add the helm repo for Grafana

...

  1. by running the following command:

    Code Block
    helm repo add grafana https://grafana.github.io/helm-charts
  2. To view data in Grafana you need to create one or more "dashboards". You can create them manually in the Grafana GUI or use a yaml file to create them in advance. This yaml file, grafana-dashboards.yaml, includes three pre-created dashboards for pico statistics, workflows, and MIMs. You can also

...

  1. use your own yaml file with your own dashboard and data source configuration for this installation. You

...

  1. must link the Prometheus server as your data source.

  2. Install Grafana using the helm install command. This example shows how to install Grafana in its own namespace called Grafana. Enter the Grafana node port number. If you have another dashboard yaml file, you can replace the value by <dashboard yaml name>.

    Code Block
    helm install -n <namespace> grafana grafana/grafana \ 
      --set service.type=NodePort \ 
      --set service.nodePort=<port> \
      -f ./<dashboard yaml name>
Info

...

Example: helm install Grafana

Code Block
helm install -n grafana grafana grafana/grafana \ 
  --set service.type=NodePort \ 
  --set service.nodePort=30090 \
  -f ./grafana-dashboards.yaml

Installing Grafana with Persistence

The following steps show how to install Grafana with the use of using persistence volumes on your Kubernetes cluster.

  1. Create a yaml file and describe the Persistent Volume and Persistent Volume Claim for Grafana. The example

...

  1. below creates the persistent volume on an NFS file server that is mounted onto the cluster. The value set in nfs.path is the directory on the NFS file server that stores the data for Grafana.

Info

...

Example: Persistence for Grafana

Code Block
apiVersion: v1
kind: PersistentVolume
metadata:
  name: grafana
spec:
  accessModes:
  - ReadWriteMany
  capacity:
    storage: 10Gi
  nfs:
    path: /export/snap/metrics/grafana
    server: files.dev.drint.net
  persistentVolumeReclaimPolicy: Retain
  storageClassName: grafana-persistent
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: grafana-persistent
spec:
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  storageClassName: grafana-persistent

...

  1. When the yaml file has been created, run this command:

    Code Block
    kubectl apply -f <persistent volume yaml> -n <namespace>
  2. Add the helm repo for Grafana

...

  1. by running this command:

    Code Block
    helm repo add grafana https://grafana.github.io/helm-charts
  2. To view data in grafana you need to create one or more "dashboards". You can create them manually in the Grafana GUI or import them from json based definition files. This zip file, grafana-dashboards.zip, includes three pre-created dashboards for pico statistics, workflows, and MIMs. You

...

  1. must link the Prometheus server as your data source.

  2. Install Grafana using the helm install command. In this example, Grafana is installed in its own namespace called grafana. Enter the Grafana node port number. Set the name of the Persistent Volume Claim

...

  1. created in the previous steps.
    If you have another dashboard yaml file, you can replace the value by <dashboard yaml name>.

    Code Block
    helm install -n <namespace> grafana grafana/grafana \ 
      --set service.type=NodePort \ 
      --set service.nodePort=<port> \ 
      --set persistence.enabled=true \ 
      --set persistence.accessMode=ReadWriteMany \ 
      --set persistence.storageClass=grafana-persistent \ 
      --set persistence.existingClaim="grafana-persistent" \
      -f ./<dashboard yaml name>
Info

...

Example: helm

...

Install Grafana -

...

With Persistence

Code Block
helm install -n grafana grafana grafana/grafana \ 
  --set service.type=NodePort \ 
  --set service.nodePort=30090 \ 
  --set persistence.enabled=true \ 
  --set persistence.accessMode=ReadWriteMany \ 
  --set persistence.storageClass=grafana-persistent \ 
  --set persistence.existingClaim="grafana-persistent" \
  -f ./grafana-dashboards.yaml

Verify the Grafana Installation

This step shows describes how to check that your Grafana is deployed correctly.

Excerpt
After installing
  1. When Grafana has been installed you are given an export command

to
  1. that you can use to acquire the URL and the Port of the Grafana GUI. The command

looks something
  1. can look like this:

    Code Block
    export NODE_PORT=$(kubectl get --namespace <namespace> -o jsonpath="{.spec.ports[0].nodePort}" services grafana)
    export NODE_IP=$(kubectl get nodes --namespace <namespace> -o jsonpath="{.items[0].status.addresses[0].address}")
Info
title

Example: Exporting the

value

Value for Grafana Node IP and Node Port

Code Block
$ export NODE_PORT=$(kubectl get --namespace grafana -o jsonpath="{.spec.ports[0].nodePort}" services grafana)
$ export NODE_IP=$(kubectl get nodes --namespace grafana -o jsonpath="{.items[0].status.addresses[0].address}")
  1. To generate the URL from the result of the two export commands above, use this echo command. Then copy the result to your browser.

    Code Block
    echo http://$NODE_IP:$NODE_PORT
Info
title

Example: Url for Grafana GUI

Code Block
http://192.168.52.26:30090
Find
  1. Retrieve the password of the admin user for Grafana. After

installing
  1. having installed Grafana, you are prompted with a message informing you how to retrieve the password. This is an example of

what it can look like
  1. how the command may look:

Info
title

Example

Code Block
kubectl get secret --namespace <namespace> grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
Note
title

Note!

If you do not have the password randomly assigned you can manually define the default admin username and password with extra variables when you run the helm install command. See the example values.yaml on https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml .