> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-hosted Grafana

> Setting up a self-hosted Grafana instance inside CKS

If you need more customization and control than [CoreWeave Grafana](/observability/managed-grafana) provides, you can deploy a self-hosted Grafana instance. With self-hosting, you can create new dashboards, export or edit CoreWeave Grafana dashboards, and freely explore all available metrics in your environment.

Self-hosted Grafana instances are deployed via [CoreWeave Charts](/products/cks/clusters/coreweave-charts/introduction). This handles most of the process of configuring Data Sources, however [authentication](#configure-coreweave-metrics-data-source-credentials) requires some manual configuration.

## Prerequisites

To set up a self-hosted Grafana instance, you will need:

* A [CoreWeave API Access Token](/security/authn-authz/managed-auth/api-access) for an active CKS account
* A CKS cluster where you intend to self-host (i.e. deploy and manage) Grafana
* [`kubectl`](https://kubernetes.io/docs/tasks/tools/) installed
* [`helm`](https://helm.sh/docs/intro/install/) installed

<Warning>
  Customers opting to self-host a Grafana instance are responsible for all setup, maintenance, and resource costs associated with hosting. Using [CoreWeave Grafana](/observability/managed-grafana) is recommended.
</Warning>

## Install Grafana with CoreWeave Charts

First, access the CoreWeave Charts repository with the following command:

```bash theme={"system"}
helm repo add coreweave https://charts.core-services.ingress.coreweave.com
```

Next, install the `grafana` chart:

```bash theme={"system"}
helm install -n <my-namespace> grafana coreweave/grafana
```

<Tip>
  The `grafana-dashboards` chart is a dependency of `grafana`, so it does not need to be installed independently.
</Tip>

## Log in to Grafana with admin credentials

Before logging into Grafana, you must port forward your Grafana service.

1. Run the following command to port forward your Grafana service:

   ```bash theme={"system"}
   $ kubectl port-forward svc/grafana -n <my-namespace> 8900:80
   ```

2. Navigate to localhost:8900. You should see a login page similar to the following:

   <img src="https://mintcdn.com/coreweave-dbfa0e8d/lx5AWUkfPyCw-jwp/observability/_media/grafana-login.png?fit=max&auto=format&n=lx5AWUkfPyCw-jwp&q=85&s=74f25ef0097f63919d72a85cbe13375b" alt="Grafana login page." width="517" height="527" data-path="observability/_media/grafana-login.png" />

3. The admin password is required to log in to Grafana for the first time. This password is stored as a Kubernetes Secret. To obtain the Secret value, run the following command, replacing `<my-namespace>` with your namespace ID:

   ```bash theme={"system"}
   $ kubectl get secret grafana -n <my-namespace> -o=jsonpath='{.data.admin-password}' | base64 --decode
   ```

   Note: If using a Mac, you might need to remove the trailing `%`.

4. Use the returned value as your password when logging in to Grafana. Now you can log in to Grafana with the following credentials:

   | Field    | Value         |
   | -------- | ------------- |
   | Username | `admin`       |
   | Password | `<my-secret>` |

## Configure CoreWeave Metrics data source credentials

After logging in to Grafana with your admin credentials, you must configure credentials for the CoreWeave-provided Data Sources. First, configure the CoreWeave Metrics data source.

### Configure the data source HTTP headers

The following HTTP header values are required to connect to CoreWeave's data sources, where `<MY-TOKEN>` is your CoreWeave [API Access Token](/security/authn-authz/managed-auth/api-access).

| Field  | Value               |
| ------ | ------------------- |
| Header | `Authorization`     |
| Value  | `Bearer <MY-TOKEN>` |

To configure these headers, navigate to **Connections** from Grafana's left-hand menu to display the dropdown options. Then, click **Data sources** to proceed to the **Data sources** page. Select **CoreWeave Metrics** from the options listed to proceed to the **Settings** menu for the new data source.

<img src="https://mintcdn.com/coreweave-dbfa0e8d/KBpmQl9RwHt6h498/observability/_media/grafana-connections-data-sources.png?fit=max&auto=format&n=KBpmQl9RwHt6h498&q=85&s=bbcb66936bb9fac4e1094b512949af78" alt="Grafana menu with data sources item indicated" width="604" height="796" data-path="observability/_media/grafana-connections-data-sources.png" />

Next, navigate to the **Authentication** section. This is the only section that requires editing.

<img src="https://mintcdn.com/coreweave-dbfa0e8d/bmSvzayNAcGFdaNU/observability/_media/grafana-authentication-http-header.png?fit=max&auto=format&n=bmSvzayNAcGFdaNU&q=85&s=865e1a087c63027d9fe7a26efdc4f41e" alt="Authentication section of Grafana data sources screen" width="1320" height="832" data-path="observability/_media/grafana-authentication-http-header.png" />

Then, click the dropdown arrow on the right-hand side of the **HTTP headers** subsection to display the **+ Add header** button.

<img src="https://mintcdn.com/coreweave-dbfa0e8d/bmSvzayNAcGFdaNU/observability/_media/grafana-authentication-add-http-header.png?fit=max&auto=format&n=bmSvzayNAcGFdaNU&q=85&s=e50c6ef79ee852959aa84fa7bfd13a8c" alt="HTTP headers section of Grafana data sources screen" width="1364" height="968" data-path="observability/_media/grafana-authentication-add-http-header.png" />

In the **Header** field, enter `Authorization`.

<img src="https://mintcdn.com/coreweave-dbfa0e8d/KBpmQl9RwHt6h498/observability/_media/grafana-http-header-fields.png?fit=max&auto=format&n=KBpmQl9RwHt6h498&q=85&s=4cc367f2366bbde25d1c5acc3deb01fd" alt="Custom header section of Grafana data sources screen" width="1250" height="336" data-path="observability/_media/grafana-http-header-fields.png" />

In the **Value** field, provide the value `Bearer <MY-TOKEN>`, where `<MY-TOKEN>` is your CoreWeave [API Access Token](/security/authn-authz/managed-auth/api-access).

Configure the HTTP method to use `GET` by changing the HTTP dropdown method in the **Other** subsection to `GET`:

<img src="https://mintcdn.com/coreweave-dbfa0e8d/lx5AWUkfPyCw-jwp/observability/_media/configure-get.png?fit=max&auto=format&n=lx5AWUkfPyCw-jwp&q=85&s=b1d16fd5aefb91bba50caadc6c3535c4" alt="Configure the HTTP method to use GET." width="536" height="163" data-path="observability/_media/configure-get.png" />

## Configure the CoreWeave Logs data source

Once the configuration for the **CoreWeave Metrics** data source is complete, repeat the steps above for the **CoreWeave Logs** Data Source.

## Learn more

For more information, explore the following resources:

* [Grafana documentation](https://grafana.com/docs/grafana/latest/) on building dashboards, working with Data Sources, exploring metrics, and more.
* [Prometheus Query Language (PromQL) documentation](https://prometheus.io/docs/prometheus/latest/querying/basics/) to learn how to get maximum utility from the **CoreWeave Metrics** data in both ad-hoc Explore queries and building advanced dashboard panels.
