This guide provides detailed steps to resolve issues where Longhorn fails to mount Persistent Volume Claims (PVC) to pods in a Kubernetes cluster. The error typically results from conflicts with the multipathd service, which can incorrectly identify Longhorn volumes as being in use, preventing the filesystem from being created.
Longhorn, a distributed block storage system for Kubernetes, failing to mount Persistent Volume Claims (PVC) to pods. This issue occurs due to conflicts with the multipathd service, which is responsible for managing multiple paths to the same storage device. When the system mistakenly identifies a Longhorn volume as being in use, it prevents the filesystem from being created, leading to the error during the mount operation.
Problem
If you encounter the following error in your Kubernetes environment, Longhorn has failed to mount a PVC to a pod.
Error Message
Solution
- Edit the
multipath.conf
file using following command: - Add the Required Configuration.
- Add the following data to the
multipath.conf
file on all nodes in the cluster: - After adding the data, the file should look like this:
- Add the following data to the
- After adding the data, restart the
multipathd.service
in all nodes. - To resolve the issue, delete the affected pods so that Kubernetes can recreate them with the corrected configuration: