Viewing metrics with Prometheus 

Using the details available in the notes, you can set up a port-forward, as we have done earlier in this book and access Prometheus directly. The information that was displayed from the notes is shown here:

export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace monitoring port-forward $POD_NAME 9090

This will allow you to directly access the Prometheus server with a browser. Run these commands in a terminal, and then open a browser and navigate to http://localhost:9090/.

You can view the current state of what Prometheus is monitoring by looking at the list of targets at http://localhost:9090/targets:

Switch ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.