<p>I have the following <code>Volume</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>Name:         pvc-c8a0c1ee-b9e6-11e9-9ffa-0cc47ab04738
Namespace:    rook-ceph-system
Labels:       &lt;none&gt;
Annotations:  &lt;none&gt;
API Version:  rook.io/v1alpha2
Attachments:
  Cluster Name:   rook-ceph
  Mount Dir:      /var/lib/kubelet/pods/72fd4f89-5110-49b7-8d88-87488b58695c/volumes/ceph.rook.io~rook-ceph-system/pvc-c8a0c1ee-b9e6-11e9-9ffa-0cc47ab04738
  Node:           node-6.xyz.com
  Pod Name:       dev-cockroachdb-0
  Pod Namespace:  x-namespace
  Read Only:      false
Kind:             Volume
Metadata:
  Creation Timestamp:  2020-08-12T17:13:51Z
  Generation:          6
  Resource Version:    638003207
  Self Link:           /apis/rook.io/v1alpha2/namespaces/rook-ceph-system/volumes/pvc-c8a0c1ee-b9e6-11e9-9ffa-0cc47ab04738
  UID:                 db0a9491-95fe-49cd-8160-89031847d636
Events:                &lt;none&gt;
</code></pre>
<p>For the pod <code>dev-cockroachdb-0</code> I'm getting the following error:</p>
<pre class="lang-sh prettyprint-override"><code>MountVolume.SetUp failed for volume &quot;pvc-c8a0c1ee-b9e6-11e9-9ffa-0cc47ab04738&quot; : mount command failed, status: Failure, reason: Rook: Mount volume failed: failed to attach volume pvc-c8a0c1ee-b9e6-11e9-9ffa-0cc47ab04738 for pod x-namespace/dev-cockroachdb-0. Volume is already attached by pod x-namespace/dev-cockroachdb-0. Status Pending
</code></pre>
<p>And the pod <code>x-namespace/dev-cockroachdb-0</code> is currently scheduled to <code>node-5.xyz.com</code>.</p>
<p>So, as you can see the pod itself is in a different node than the <code>VolumeAttachment</code>. <code>node-6.xyz.com</code> vs <code>node-5.xyz.com</code>.</p>
<p>Questions:</p>
<ul>
<li>Does <code>Node</code> in <code>Volume.Attachments</code> point to the node on which the pod (to which the volume is attached) is located? (So if the volume is attached to a pod on node <code>NodeA</code>, then the value of node field for the volume attachment will be <code>NodeA</code>)</li>
<li>May this error happen because of the failure to correctly detach the volume on some node?</li>
</ul>

<p>You didn't mention it but it looks like you have a Rook volume. Perhaps a pvc-clone, something like this:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: rbd-pvc-clone
spec:
  storageClassName: rook-ceph-block
  dataSource:
    name: rbd-pvc
    kind: PersistentVolumeClaim
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
</code></pre>
<blockquote>
<p>Does Node in Volume.Attachments point to the node on which the pod (to which the volume is attached) is located? (So if the volume is attached to a pod on node NodeA, then the value of node field for the volume attachment will be NodeA)</p>
</blockquote>
<p>Not really, your Pod may be trying to start on <code>node-5.xyz.com</code>, but the volume could be attached to another node in your case it's <code>node-6.xyz.com</code>.</p>
<blockquote>
<p>May this error happen because of the failure to correctly detach the volume on some node?</p>
</blockquote>
<p>Yes, this error may happen if maybe you had another pod running in <code>node-6.xyz.com</code> that terminated and failed to detach.</p>
<p>Keep in mind that all of the above is considering that your volume has <code>accessModes: ReadWriteOnce</code>. It looks like you are using Ceph with Rook and in that case, you can also use <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes" rel="nofollow noreferrer"><code>accessModes: ReadWriteMany</code></a> which would essentially allow you to attach the volume to Kubernetes nodes.</p>
<p>✌️</p>
