Bootstrap FreeKB - OpenShift - Resolve "FailedMount Unable to attach or mount volumes timed out waiting for the condition"
OpenShift - Resolve "FailedMount Unable to attach or mount volumes timed out waiting for the condition"

Updated:   |  OpenShift articles

Let's say the following is being returned when attempting to start a pod.

Unable to attach or mount volumes: unmounted volumes=[volume001], unattached volumes=[volume001]: timed out waiting for the condition

 

In this example, a time out occurred when attempting to mount the volume named "volume001" to the pod. The oc describe command can be used to gather additional information about the volume. Notice in this example that volume001 is a Persistent Volume Claim (pvc).

~]# oc describe pod myapp-587bf9588f-nqhsq
Volumes:
  my-data:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  pvc001
    ReadOnly:   false

 

The oc get pvc command can be used to list the Persistent Volume Claims in the namespace. One simple possibility is that the Persistent Volume Claim does not exist.

~]$ oc get pvc
NAME          STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
pvc001        Bound    pvc-385996a0-70af-4791-aa8e-9e6459e6b123   1Gi        RWO            file-storage   659d
pvc002        Bound    pvc-8aeddd4d-aad5-4039-8d04-640a71c9a72d   10Gi       RWO            file-storage   659d
pvc003        Bound    pvc-0050144d-940c-4c4e-a23a-2a660a5490eb   10Gi       RWO            file-storage   659d

 

If the Persistent Volume Claim exists, use the oc describe pvc command to display more information about the Persistent Volume Claim. Notice in this example that the Access Mode is RWO (Read Write Once).

~]$ oc describe pvc pvc001
Name:          pvc001
Namespace:     foo
StorageClass:  file-storage
Status:        Bound
Volume:        pvc-385996a0-70af-4791-aa8e-9e6459e6b123
Labels:        app=myapp
               component=my-database
               template=my-database-template
Annotations:   pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
               volume.beta.kubernetes.io/storage-provisioner: csi.trident.netapp.io
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      10Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Used By:       myapp-587bf9588f-nqhsq
Events:        <none>

 

Which can also be seen with the oc get pvc command.

~]$ oc get pvc pvc001 --output yaml
spec:
  accessModes:
  - ReadWriteOnce

 

When the Access Mode is Read Write Once, the Persistent Volume Claim can only be used by a single node, and then only one pod on the node can attach the Persistent Volume Claim. If two (or more) pods attempt to attach the Persistent Volume Claim, a Multi-Attach error for volume event could be returned.

Multi-Attach error for volume "pvc-385996a0-70af-4791-aa8e-9e6459e6b123" Volume is already used by pod(s) nginx-587bf9588f-gmbcn

 

Or already attached to another node could be returned.

Error while attaching the device pv pvc-385996a0-70af-4791-aa8e-9e6459e6b123 cannot be attached to the node 10.10.152.11. 
PV pvc-385996a0-70af-4791-aa8e-9e6459e6b123 is already attached to another node 10.10.152.11 and there are active pods [nginx-587bf9588f-gmbcn] using that

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter b70962 in the box below so that we can be sure you are a human.