Skip to content

Grafana Installation

Goal⚓︎

Enable a working Grafana instance in your Hydrolix cluster using the built-in Grafana service.

Overview of steps⚓︎

  1. Modify the Hydrolix configuration
  2. Obtain your Grafana administrative password
  3. View Grafana interface
  4. Use the Hydrolix data source for queries

Before you begin⚓︎

  • Make sure you're running Hydrolix version 5.1 or later.
  • Have kubectl, k9s, or both configured for your Hydrolix instance.
  • Make sure your Kubernetes cluster has room for the Grafana pod and its renderer sidecar. Their CPU and memory requests depend on your scale profile. For example, the eval profile runs one Grafana replica, and the prod profile runs two.

Installation⚓︎

Modify the Hydrolix configuration⚓︎

Edit your Hydrolix cluster's configuration to include the Grafana in-cluster integration. Add the following lines to the spec: section of your Hydrolix configuration:

Enable Grafana in Cluster Configuration
data_visualization_tools:
  - grafana

Example hydrolixcluster.yaml configuration:

Example hydrolixcluster.yaml
1
2
3
4
5
6
7
spec:
  acme_enabled: true
  admin_email: admin@mycompany.com
  data_visualization_tools:
    - grafana
  db_bucket_endpoint: https://us-sea-1.linodeobjects.com
  db_bucket_region: us-sea-1

Load the configuration changes into your Hydrolix cluster with kubectl apply -f hydrolixcluster.yaml or by saving your changes in k9s.

Wait for the Grafana pod to start⚓︎

Wait for the Grafana Kubernetes pod to start. This can take several minutes. You can tell when it's ready for use by spotting the Running indicator in the output of the kubectl command.

Check the Grafana Pod
1
2
3
kubectl get pods | grep -E 'grafana'

grafana-864958596c-wnv6x  2/2  Running  0  8m37s

Verify the web interface⚓︎

Make sure you're signed in to your Hydrolix cluster's UI by visiting https://hostname.hydrolix.live in a web browser.

Visit https://hostname.hydrolix.live/grafana in your web browser to see Grafana's UI. You should be directed to a sign-in page.

If the UI isn't available after a few minutes, see Troubleshoot.

Obtain and use your Grafana administrative password⚓︎

The built-in Grafana instance comes with an administrative user named admin and a generated password. To use a different username, set grafana_config.admin_user.

  • Using k9s

    1. Open :secrets in k9s.
    2. Select the general secret and press x to decode its values.
    3. Locate the value of GRAFANA_ADMIN_PASSWORD.
  • Using kubectl

    kubectl get secret general -o jsonpath="{.data.GRAFANA_ADMIN_PASSWORD}" | base64 --decode
    

View the Grafana interface⚓︎

  1. Visit https://hostname.hydrolix.live/grafana in your web browser.

  2. Use the admin username and the password you decoded in the previous step.

Use the Hydrolix data source for queries⚓︎

As of v5.5.0, in-cluster Grafana instances deploy with the Hydrolix data source plugin installed. This data source is viewable at https://hostname.hydrolix.live/grafana/connections/datasources with the name Hydrolix - Local.

Use the Hydrolix data source when querying and configuring dashboards to take advantage of the features in the Hydrolix data source plugin.

To deploy Grafana without this data source, set the grafana_config.datasources.hydrolix_enabled tunable to false. This suits a cluster with no query components running, such as one that's scaled to minimal. This tunable was introduced in Hydrolix version 6.1.

Upgrade the Hydrolix data source plugin by upgrading Hydrolix instead of through the Grafana interface. If you upgrade the plugin in Grafana, Grafana reverts it the next time its pod restarts. Each Hydrolix release ships with a specific plugin version.

Verification⚓︎

Verify metrics are queryable from Grafana by running a test query and optionally creating a dashboard.

  1. Visit https://hostname.hydrolix.live/grafana/dashboards in your web browser.
  2. Select New > New dashboard.
  3. Select + Add visualization.
  4. Select Hydrolix - Local from the data source dropdown.
  5. Paste the following query into the query input box:

    Count Errors by Container
    SELECT
      count(*) as error_count,
      toStartOfMinute(timestamp) AS minute,
      container
    FROM
      hydro.logs
    WHERE
      timestamp > NOW() - INTERVAL 1 DAY
      AND level = 'error'
    GROUP BY
      minute, container
    ORDER BY
      minute ASC
    
  6. Change Query Type to TimeSeries.

  7. In the right panel, change No value to 0.

    You should now have a timeseries visualization showing the count of errors by container for your Hydrolix cluster.

    Hydrolix cluster error count by container

  8. Select Save dashboard if you want to save this visualization in a new dashboard.

Troubleshoot⚓︎

Not enough resources⚓︎

If the grafana-* pod isn't starting and the kubectl or k9s utility is showing the pod in a pending state, check the resources on the nodes backing your Hydrolix installation. You can lower the CPU and memory that Grafana and its renderer service request from Kubernetes. For more about scaling pods and services, see Scale Clusters with Hydrolix. This example is a low-overhead configuration in the Hydrolix spec file:

Low-Overhead Grafana Scale Settings
1
2
3
4
5
6
7
8
spec:
  scale:
    grafana:
      cpu: 2
      memory: 2Gi
    renderer:
      cpu: 1
      memory: 1Gi

PostgreSQL not available⚓︎

Grafana stores its dashboards, users, alerts, and query history in a database named grafana on the same PostgreSQL instance as the Hydrolix catalog database.

Grafana connects to that instance with the pg_ssl_mode setting that the other cluster-internal services use. Its default is disable, so Grafana connects without SSL unless you change it. If your PostgreSQL instance accepts only SSL connections, Grafana can't connect until you set pg_ssl_mode to require, verify-ca, or verify-full:

Require SSL for PostgreSQL Connections
spec:
  pg_ssl_mode: require

The pg_ssl_mode tunable configures all PostgreSQL clients in the cluster

This setting applies to every Hydrolix service that connects to the catalog database, not only Grafana.

If Grafana uses its own external database, set in grafana_config.database, Grafana ignores pg_ssl_mode. Set grafana_config.database.ssl_mode to require or disable instead.

Next steps⚓︎

See the Hydrolix Data Source Plugin for Grafana for more details on configuring the data source plugin and a list of plugin features.