Configure Observability with Prometheus and Grafana
The following article shows you how to install OSM with automatic provisioning of the Prometheus and Grafana stack for observability and monitoring. For an example using a bring your own (BYO) Prometheus and Grafana stack on your cluster with OSM, see the Integrate OSM with Prometheus and Grafana demo.
The configuration created in this article should not be used in production environments. For production-grade deployments, see Prometheus Operator and Deploy Grafana in Kubernetes.
Install OSM with Prometheus and Grafana
On osm install
, a Prometheus and/or Grafana instance can be automatically provisioned with the default OSM configuration.
osm install --set=osm.deployPrometheus=true \
--set=osm.deployGrafana=true
More information on observability can be found in the Observability Guide.
Prometheus
When configured with the --set=osm.deployPrometheus=true
flag, OSM installation will deploy a Prometheus instance to scrape the sidecar and OSM control plane’s metrics endpoints. The scraping configuration file defines the default Prometheus behavior and the set of metrics collected by OSM.
Grafana
OSM can be configured to deploy a Grafana instance using the --set=osm.deployGrafana=true
flag in osm install
. OSM provides pre-configured dashboards that are documented in the OSM Grafana dashboards section of the Observability Guide.
Enable Metrics Scraping
Metrics can be enabled at the namespace scope using the osm metrics
command. By default, OSM does not configure metrics scraping for pods in the mesh.
osm metrics enable --namespace test
osm metrics enable --namespace "test1, test2"
Note: The namespace that you are enabling for metrics scraping must already be a part of the mesh.
Inspect Dashboards
The OSM Grafana dashboards can be viewed with the following command:
osm dashboard
Note: If you still have the additional terminal still running the
./scripts/port-forward-all.sh
script, go ahead andCTRL+C
to terminate the port forwarding. Theosm dashboard
port redirection will not work simultaneously with the port forwarding script still running.
Navigate to http://localhost:3000 to access the Grafana dashboards. The default user name is admin
and the default password is admin
. On the Grafana homepage click on the Home icon, you will see a folder containing dashboards for both OSM Control Plane and OSM Data Plane.
Next Steps
Cleanup sample applications and uninstall OSM.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.