Symptom
No NPU container information is obtained through the Metrics interface (http://ip:port/metrics) of NPU Exporter. The logs of the component contain the following information:
failed to init devices parser: connecting to container runtime failed: context deadline exceeded
Cause Analysis
The default socket file paths of the NPU Exporter parameters -containerd and-endpoint are incorrect. The file paths vary according to the OS.
Solution
- The default value (docker) of the NPU Exporter parameter -containerMode indicates that Kubernetes uses Docker as the container runtime. In this case, you need to configure -containerd and -endpoint accordingly. You can locate the socket and modify the YAML mounting path and NPU Exporter startup parameters by referring to Table 1. Then restart the service.
- If -containerMode is containerd, perform the same operations. But, you need to delete the mount path whose name is docker-shim from the YAML file at the same time.
Table 1 containerd and endpoint parametersStartup Parameter
|
Container Mode
|
Description
|
-containerd
|
- If containerMode is set to docker, the default socket file path is /var/run/docker/containerd/docker-containerd.sock. If the connection fails, the system automatically attempts to connect unix:///run/containerd/containerd.sock.
- If containerMode is set to containerd, the default socket file path is /run/containerd/containerd.sock.
|
Generally, retain the default value of this parameter unless you change the sock file path of containerd. You can run the ps aux | grep "containerd.sock" command to query the path.
|
-endpoint
|
- If containerMode is set to docker, Dockershim is connected to obtain the container list. The default socket file path is /var/run/dockershim.sock.
- If containerMode is set to containerd, the default socket file path is /run/containerd/containerd.sock.
|
Generally, retain the default value unless you have changed the sock file path of Dockershim or containerd.
|