The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.

Chapter 3 Using Grafana

When Grafana is deployed, a data source is configured for a Prometheus time-series database. A data source is Grafana's link to the database. Because this data source is configured, Grafana can retrieve and analyze the metrics of a Kubernetes cluster that are gathered and stored in the Prometheus database.

In this chapter, you learn how to:

  • Get the IP address of the node on which Grafana is deployed and the port number that is reserved for Grafana. You need this information to access the Grafana console.

  • Access the Grafana console.

  • Create a dashboard in Grafana to monitor and visualize the metrics that are retrieved and analyzed from Prometheus through the data source.

  • Formulate a query for the dashboard to fine-tune how the metrics for Prometheus appear in Grafana.

3.1 Getting the Grafana IP Address and Port Number

In this section, you get the IP address of the node on which Grafana is deployed and the port number for Grafana.

  1. At the prompt of the machine where you installed the Istio module, enter the following command:

    $ kubectl -n istio-system get svc grafana

    There is no NodePort set up for the port on which the Grafana service is running. In this example, the port that is reserved for Grafana is 9090.

    NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)      AGE
    grafana      ClusterIP   10.104.245.12   <none>        9090/TCP     6d1h

    A NodePort is an open port on every node of your Kubernetes cluster. By opening a NodePort for Grafana, Kubernetes transparently routes incoming traffic on the NodePort to the Grafana service. The NodePort is assigned from a pool of cluster-configured NodePort ranges (typically 30000–32767).

  2. Enter the following command to set up a NodePort for the Grafana service:

    $ kubectl patch svc grafana -n istio-system -p '{"spec":{"type":"NodePort"}}'
  3. Verify that you see the service/grafana patched status message.

    You can now connect to Grafana via the NodePort.

  4. Enter the following command again:

    $ kubectl -n istio-system get svc grafana

    This time, you can see that a NodePort is set up for the Grafana container. You can use this NodePort to connect to the service.

    NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)      AGE
    grafana      ClusterIP   10.104.245.12   <none>        9090/30921   6d1h

    In this example, the NodePort is 30921, which maps to the service port of 9090.

  5. Enter the following command to get the IP address of either a master node or the IP address of the worker node on which the Grafana container is running:

    $ ip addr

Make a note of the IP address and NodePort that you obtained in this procedure because you need these values to access the Grafana console.