Grafana Configuration Guide

Using an existing Grafana deployment can be accomplished through one of two options:

  1. Linking to an external Grafana directly

  2. Deploying with Grafana sidecar enabled

After installing Kubecost, select Settings from the left navigation and update Grafana Address to a URL that is visible to users accessing Grafana dashboards. This variable can alternatively be passed at the time you deploy Kubecost via the kubecostProductConfigs.grafanaURL parameter in values.yaml. Next, import Kubecost Grafana dashboards as JSON from this folder.

Option 2: Deploy with Grafana sidecar enabled

Passing the Grafana parameters below in your values.yaml will install ConfigMaps for Grafana dashboards that will be picked up by the Grafana sidecar if you have Grafana with the dashboard sidecar already installed.

global:
  grafana:
    enabled: false
    domainName: cost-analyzer-grafana.default #example where format is <service-name>.<namespace>
    proxy: false
grafana:
  sidecar:
    dashboards:
      enabled: true
    datasources:
      enabled: false

Ensure that the following flags are set in your Operator deployment:

  1. sidecar.dashboards.enabled=true

  2. sidecar.dashboards.searchNamespace isn't restrictive. Use ALL if Kubecost runs in another namespace.

The Kubecost UI cannot link to the Grafana dashboards unless kubecostProductConfigs.grafanaURL is set, either via the Helm chart, or via the Settings page, as described in Option 1.

When using Kubecost on a custom ingress path, you must add this path to the Grafana root_url:

--set grafana.grafana.ini.server.root_url: "%(protocol)s://%(domain)s:%(http_port)s/kubecost/grafana"

Disabling Grafana

If you choose to disable Grafana, set the following Helm values to ensure successful pod startup:

--set global.grafana.enabled=false
--set global.grafana.proxy=false

Last updated