# Access dashboards using port forwarding

This topic includes information about how to access Prometheus, Grafana, and Alertmanager in Replicated KOTS existing cluster and Replicated kURL installations.

For information about how to configure Prometheus monitoring in existing cluster installations, see [Configure Prometheus Monitoring in Existing Cluster KOTS Installations](monitoring-applications).

## Overview

The Prometheus [expression browser](https://prometheus.io/docs/visualization/browser/), Grafana, and some preconfigured dashboards are included with Kube-Prometheus for advanced visualization. Prometheus Altertmanager is also included for alerting. You can access Prometheus, Grafana, and Alertmanager dashboards using `kubectl port-forward`.

:::note
You can also expose these pods on NodePorts or behind an ingress controller. This is an advanced use case. For information about exposing the pods on NodePorts, see [NodePorts](https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizations/node-ports.md) in the kube-prometheus GitHub repository. For information about exposing the pods behind an ingress controller, see [Expose via Ingress](https://github.com/prometheus-operator/kube-prometheus/blob/main/docs/customizations/exposing-prometheus-alertmanager-grafana-ingress.md) in the kube-prometheus GitHub repository.
:::

## Prerequisite

For existing cluster KOTS installations, first install Prometheus in the cluster and configure monitoring. See [Configure Prometheus Monitoring in Existing Cluster KOTS Installations](monitoring-applications)

## Access Prometheus

To access the Prometheus dashboard:

1. Run the following command to port forward the Prometheus service:

   ```bash
   kubectl --namespace monitoring port-forward svc/prometheus-k8s 9090
   ```

1. Access the dashboard at http://localhost:9090.

## Access Grafana

Users can access the Grafana dashboard by logging in using a default username and password. For information about configuring Grafana, see the [Grafana documentation](https://grafana.com/docs/). For information about constructing Prometheus queries, see [Querying Prometheus](https://prometheus.io/docs/prometheus/latest/querying/basics/) in the Prometheus documentation.

To access the Grafana dashboard:

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

   ```bash
   kubectl --namespace monitoring port-forward deployment/grafana 3000
   ```
1. Access the dashboard at http://localhost:3000.
1. Log in to Grafana:
   * **Existing cluster**: Use the default Grafana username and password: `admin:admin`.
   * **kURL  cluster**: The Grafana password is randomly generated by kURL and is displayed on the command line after kURL provisions the cluster. To log in, use this password generated by kURL and the username `admin`.

      To retrieve the password, run the following kubectl command:

      ```
      kubectl get secret -n monitoring grafana-admin -o jsonpath="{.data.admin-password}" | base64 -d
      ```

## Access Alertmanager

Alerting with Prometheus has two phases:

* Phase 1: Alerting rules in Prometheus servers send alerts to an Alertmanager.
* Phase 2: The Alertmanager then manages those alerts, including silencing, inhibition, aggregation, and sending out notifications through methods such as email, on-call notification systems, and chat platforms.

For more information about configuring Alertmanager, see [Configuration](https://prometheus.io/docs/alerting/configuration/) in the Prometheus documentation.

To access the Alertmanager dashboard:

1. Run the following command to port forward the Alertmanager service:

   ```
   kubectl --namespace monitoring port-forward svc/prometheus-alertmanager 9093
   ```

1. Access the dashboard at http://localhost:9093.