Skip to main content
Monitor your Kubernetes cluster using the kube-prometheus-stack, which includes Prometheus for metrics collection and Grafana for visualization.

Initial Setup

The kube-prometheus-stack is installed using Helm. This bundle includes Prometheus, Grafana, and pre-configured dashboards for Kubernetes monitoring. Refer to the kube-prometheus-stack documentation for more details.

Install kube-prometheus-stack

kubectl create namespace monitoring
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring

Verify Installation

Check that all Prometheus components are running:
kubectl --namespace monitoring get pods -l "release=prometheus"
You should see pods for Prometheus, Grafana, Alertmanager, and various exporters.

Accessing Grafana

Grafana provides a web interface for visualizing metrics collected by Prometheus.

Retrieve Admin Password

The default admin password is stored in a Kubernetes secret:
kubectl --namespace monitoring get secrets prometheus-grafana -o jsonpath="{.data.admin-password}" | base64 -d ; echo

Access Grafana Dashboard

Port-forward to access the Grafana UI locally:
export POD_NAME=$(kubectl --namespace monitoring get pod -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=prometheus" -oname)
kubectl --namespace monitoring port-forward $POD_NAME 3000
Open your browser to http://localhost:3000 and log in with:
  • Username: admin
  • Password: (retrieved from the command above)

Viewing Metrics

Grafana comes pre-configured with dashboards for:
  • Kubernetes cluster metrics
  • Node metrics (CPU, memory, disk)
  • Pod metrics
  • Application-specific metrics
For production environments, consider exposing Grafana through an Ingress with proper authentication rather than using port-forward.

Accessing Prometheus

Access the Prometheus UI directly to query metrics and check targets:
kubectl port-forward svc/prometheus-kube-prometheus-prometheus 9090:9090 -n monitoring
Open your browser to http://localhost:9090 to access the Prometheus dashboard.

Dashboard Screenshots

Below are examples of Grafana dashboards you’ll have access to:
Grafana Cluster Overview Dashboard
Grafana Pod Metrics Dashboard

Next Steps

  • Configure custom alerts in Prometheus
  • Create custom Grafana dashboards for your applications
  • Set up persistent storage for Prometheus data
  • Configure external access via Ingress

Build docs developers (and LLMs) love