<p>I have created a <code>jenkins</code> installation via its official <code>helm</code> <a href="https://github.com/helm/charts/tree/master/stable/jenkins" rel="nofollow noreferrer">chart</a> on GKE.</p>

<p>As it is evident from the <a href="https://github.com/helm/charts/blob/master/stable/jenkins/templates/jenkins-master-deployment.yaml#L385" rel="nofollow noreferrer">deployment</a>, it will create a PVC to mount the jenkins home path (i.e. <code>/var/jenkins_jome</code>) to the persistent disk.</p>

<p>I am creating a GCP persistent disk for this purpose. (it will either way create it automatically since the provisioning is done on a cloud provider).</p>

<p>My question is the following (and is <code>kubernetes</code> specific, not directly related to jenkins)</p>

<p>Since the PD (on which the corresponding PV/PVC are created) is attached to a node, what happens if the jenkins master pod gets scheduled (say after a restart) to a different node?</p>

<p>Will the PD "follow" the node?</p>

<p>Is there a case of the <code>jenkins</code> master pod being unable to find the PVC?</p>

pkaramol
<blockquote>
  <p>Will the [persistent disk] "follow" the node?</p>
</blockquote>

<p>Yes.  For volume types that can be dynamically attached to nodes, the storage provider will attach the volume to the node on which the corresponding pod is scheduled.</p>

<p>The other corollary to this for your application is that, if you use a newer Jenkins image in the deployment (and so delete and recreate the pod), if the new pod gets scheduled on a different node, the persistent disk can get moved.</p>

<p>(For this specific scenario you might find StatefulSets' handling of persistent volumes a little better than Deployments'; <a href="https://github.com/helm/charts/blob/master/stable/jenkins/templates/jenkins-master-deployment.yaml#L26" rel="nofollow noreferrer">in the Helm chart you link to</a> it sets the Deployment <code>strategy: { type: Recreate }</code> if persistence is enabled.  This avoids a problem where the new pod can't be started until the old pod terminates and releases the PersistentVolumeClaim, but the old pod can't terminate until the new pod is up and running.)</p>
