You need to enable JavaScript to run this app.
Volcengine Managed Service for Prometheus

Volcengine Managed Service for Prometheus

Copy page
Download PDF
Resource and application monitoring
Monitoring GPUs in a custom Kubernetes cluster
Copy page
Download PDF
Monitoring GPUs in a custom Kubernetes cluster
You can use Volcengine Managed Service for Prometheus (VMP) to monitor GPUs in the nodes of your self-built cluster. This topic describes the procedure and considerations for configuration.​
Background​
In Kubernetes clusters, you can use the dcgm-exporter agent to expose GPU metrics Therefore, you can use VMP to monitor the status information of GPUs in the nodes of your self-built cluster.​
Prerequisites​
  • A Volcano Engine root user has been created, and VMP has been activated.​
  • A self-built Kubernetes cluster is created, and GPU nodes exist in the cluster. ​
  • The Kubernetes version of the self-built cluster is v1.20 to v1.24. Otherwise, compatibility issues may occur.​
  • The local environment (Linux/Mac) is configured. ​
  • Download and install the latest version of the kubectl tool in the local environment. For more details, refer to Install Tools.​
  • In the local environment, use kubectl to connect to the self-built cluster.​
  • Correctly install command-line tools (such as wget, echo, curl, and sed) in the local environment.​
Procedure​
Step 1: Install dcgm-exporter in the cluster​
Install the dcgm-exporter agent in the self-built cluster. For more details, refer to the official documentation of GitHub.​
Step 2: Deploy the collector​
  1. Download the script in the local environment. For details, see Obtaining scripts.​
  1. Use kubectl to connect to the self-built cluster.​
  1. Run the following command to deploy the VM Agent collector in the self-built cluster:​
​
./install.sh \​
--agent vmagent \ # The collector type.​
--region cn-beijing \ # The region of the VMP workspace.​
--namespace volcano-metrics \ # The namespace of the collector.​
--remote-write-url http://vmp-test.com/workspaces/b762e1a3-37***/api/v1/write \ # The URL of the VMP workspace. You need to change the domain name to the custom domain name.​
--basic-auth-username username-demo \ # The username for authentication in Basic Auth mode of the VMP workspace.​
--basic-auth-password password-demo # The password for authentication in Basic Auth mode of the VMP workspace.​
​
Step 3: Configure a collection rule​
Use ServiceMonitor or PodMonitor to configure a collection rule in the self-built cluster. This topic provides an example of how to configure a collection rule by using ServiceMonitor.​
​
apiVersion: monitoring.coreos.com/v1​
kind: ServiceMonitor​
metadata:​
name: gpu-discover # Configure the collection rule name.​
namespace: default # Configure the namespace. The namespace is not required to be the same as that of the collector or exporter.​
spec:​
endpoints:​
- port: metrics # Specify the value of the name field for the port in service.yaml.​
relabelings: # Configure metric relabeling. This parameter can be omitted if it is not required.​
- targetLabel: environment ​
action: replace # In this example, a fixed label is added: environment="Production"​
replacement: Production​
namespaceSelector:​
matchNames:​
- kube-system # Specify the namespace where the exporter is located. The namespace is used for filtering.​
selector:​
matchLabels:​
app.kubernetes.io/name: dcgm-exporter # Specify the value of the Label field in service.yaml. The label is used to select the collection target.​
​
tip​
For more configuration methods of service discovery in clusters, refer to Service discovery.​
Validate results​
Log in to Grafana and create a GPU-related dashboard by using a GPU-related PromQL statement. Then, you can view the GPU monitoring information.​
​​​
tip​
For GPU-related PromQL statements, see DCGM metrics.​
​
Last updated: 2026.10.10 11:04:51