Using an existing Grafana deployment can be accomplished with either of the following two options:
After Kubecost installation, select Settings from the left navigation and update Grafana Address to a URL (e.g. http://demo.kubecost.com/grafana) 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.
Grafana Address option
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
For Option 2, ensure that the following flags are set in your Operator deployment:
- sidecar.dashboards.enabled = true
- sidecar.dashboards.searchNamespace isn't restrictive, use
ALL
if Kubecost runs in another namespace.
Note that with Option 2, 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.
Note: 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"