"connecting to container runtime failed" Is Displayed in Logs
Symptom
No NPU container information is obtained through the Metrics interface (http(s)://ip:port/metrics) of the NPU-Exporter. The logs of the component contain the following information:
failed to init devices parser: connecting to container runtime failed: context deadline exceeded
Causes
The default socket file paths configured for the NPU-Exporter startup parameters -containerd and -endpoint are incorrect. The paths may vary according to operating systems.
Solution
- The default value (docker) of the NPU-Exporter parameter -containerMode indicates that when Kubernetes uses Docker as the container runtime. You need to configure the -containerd and -endpoint parameters based on the Docker as the container runtime. 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.
- When the startup parameter -containerMode is set to containerd, you need to delete the mount path whose name is docker-shim from the YAML file.
Startup Parameter |
Container Mode |
Default Value |
Description |
|---|---|---|---|
-containerd |
containerMode=docker (default) |
/var/run/docker/containerd/docker-containerd.sock (If the connection fails, try /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 following command to query the path: ps aux | grep "containerd.sock" |
containerMode=containerd |
/run/containerd/containerd.sock |
||
-endpoint |
containerMode=docker (default) |
/var/run/dockershim.sock |
Generally, retain the default value unless you have changed the sock file path of dockershim or containerd. |
containerMode=containerd |
/run/containerd/containerd.sock |