Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Microservices Observability in a Kubernetes World: Metrics
75%

Using Grafana to Visualize Prometheus Metrics

There is no need to install Grafana separately since it is already installed as part of the Prometheus Operator installation. To access it, we are going to use the same port-forwarding technique as before (alternatively, you can create an external access method with a Kubernetes service):

# On the workspace machine
kubectl \
  -n monitoring \
  port-forward \
  svc/grafana 3000 \
  > /dev/null 2>&1 &

# On the workspace machine, get the public IP address
curl http://ifconfig.me; echo

# On your local machine, create the SSH tunnel
# Replace  with the IP address of your remote machine
IP=
ssh -NfL 3000:localhost:3000 root@$IP

Visit http://localhost:3000 in your web browser. The default username and password for Grafana are admin and admin.

Grafana is a powerful open-source visualization and analytics platform that integrates with a plethora of data sources, including Prometheus — that's exactly what we are doing here. It allows you to create, explore, and share dashboards that visualize your metrics in various formats such as graphs, tables, heatmaps, lists, funnels, and more.

In this installation, Prometheus is already configured as a data source. Nothing more is needed.

To view the list of data sources, select Connections -> Data Sources from the left panel (this may vary depending on the Grafana version). You should see Prometheus listed as a data source. You can click on Explore to start visualizing metrics.

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.