This document describes how to configure your Google Kubernetes Engine deployment so that you can use Google Cloud Managed Service for Prometheus to collect metrics from NVIDIA Data Center GPU Manager. This document shows you how to do the following:
- Set up the exporter for DCGM to report metrics.
- Configure a PodMonitoring resource for Managed Service for Prometheus to collect the exported metrics.
These instructions apply only if you are using managed collection with Managed Service for Prometheus. If you are using self-deployed collection, then see the source repository for DCGM Exporter for installation information.
These instructions are provided as an example and are expected to work in most Kubernetes environments. For information about a managed DCGM offering, see Collect and view DCGM metrics.
If you are having trouble installing an application or exporter due to restrictive security or organizational policies, then we recommend you consult open-source documentation for support.
For information about DCGM, see NVIDIA DCGM.
Prerequisites
To collect metrics from DCGM by using Managed Service for Prometheus and managed collection, your deployment must meet the following requirements:
- Your cluster must be running Google Kubernetes Engine version 1.21.4-gke.300 or later.
- You must be running Managed Service for Prometheus with managed collection enabled. For more information, see Get started with managed collection.
Verify that you have sufficient quota for NVIDIA GPUs.
To enumerate GPU nodes in your GKE cluster and their GPU types in the relevant cluster, run the following command:
kubectl get nodes -l cloud.google.com/gke-gpu -o jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.metadata.labels.cloud\.google\.com/gke-accelerator}{"\n"}{end}'
Note that you might have to install a compatible NVIDIA GPU driver on the nodes if automatic installation was disabled or not supported for your GKE version. To verify that the NVIDIA GPU device plugin is running, run the following command:
kubectl get pods -n kube-system | grep nvidia-gpu-device-plugin
Install the DCGM exporter
We recommend that you install the DCGM exporter,
DCGM-Exporter
, by using the following config:
Set up port-forwarding with the following command:
kubectl -n gmp-public port-forward POD_NAME 9400
Access the endpoint
localhost:9400/metrics
by using the browser or thecurl
utility in another terminal session.
You can customize the ConfigMap section to select which GPU metrics to emit.
Alternatively, consider using the official Helm chart to install DCGM Exporter.
To apply configuration changes from a local file, run the following command:
kubectl apply -n NAMESPACE_NAME -f FILE_NAME
You can also use Terraform to manage your configurations.
Define a PodMonitoring resource
For target discovery, the Managed Service for Prometheus Operator requires a PodMonitoring resource that corresponds to the DCGM exporter in the same namespace.
You can use the following PodMonitoring configuration:
To apply configuration changes from a local file, run the following command:
kubectl apply -n NAMESPACE_NAME -f FILE_NAME
You can also use Terraform to manage your configurations.
Verify the configuration
You can use Metrics Explorer to verify that you correctly configured the DCGM exporter. It might take one or two minutes for Cloud Monitoring to ingest your metrics.
To verify the metrics are ingested, do the following:
-
In the Google Cloud console, go to the leaderboard Metrics explorer page:
If you use the search bar to find this page, then select the result whose subheading is Monitoring.
- In the toolbar of the query-builder pane, select the button whose name is either code MQL or code PromQL.
- Verify that PromQL is selected in the Language toggle. The language toggle is in the same toolbar that lets you format your query.
- Enter and run the following query:
DCGM_FI_DEV_GPU_UTIL{cluster="CLUSTER_NAME", namespace="gmp-public"}
Troubleshooting
For information about troubleshooting metric ingestion problems, see Problems with collection from exporters in Troubleshooting ingestion-side problems.