<p>I am creating a deployment that is going to use a GCE persistent disk to create a volume for the deployment's pod to use.</p>

<p>Since the pod is ephemeral, it may so happen that upon restarts, it ends up on a different node than the PD/PV/PVC.</p>

<p>In that case the following error may occur</p>

<pre><code>Multi-Attach error for volume Volume is already exclusively attached
</code></pre>

<p>I am aware of <a href="https://stackoverflow.com/a/46893114/2409793">this</a> answer.</p>

<p>My question is whether there is a way of predictably / consistently collocating the pod that needs the volume and the PD on the same node so as to avoid restart delays.</p>

pkaramol
<p>Add a label to the node that includes the name of the PVC or a common label used by the PV and PVC, you can then use <a href="https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector" rel="nofollow noreferrer">node selector</a> to ensure that the pod (or pods) always get scheduled to that node. This is not the most scalable method and also not very resilient because you'll have a single point of failure.</p>

<p>You may also want to consider using StatefulSets since those can include a PersistentVolumeTemplate which will provision the PVC (which will dynamically provision the PV). The StatefulSet will also try to keep a pod on the same node to maintain state.</p>
