<p>I want to create a replication controller with a POD which will have a PVC (persistent volume claim).  My PVC will use an NFS storage for PV(Persistent Volume).</p>

<p>Once the POD is operational the RC would maintain the PODs up and running. In this situation would the data in the POD be available / persistent when</p>

<ol>
<li>the POD is stopped/deleted by a delete command and RC re-launches it? That means Kubernetes was not shutdown. In this case can the new POD have the same data from the same volume?</li>
<li>the POD was stopped, Kubernetes process and the nodes were restarted. The NFS storage however was still attached as PV. </li>
<li>A new PV is attached to Kubernetes and the old PV is detached. </li>
</ol>

Santanu Dey
<p>that depends a lot on how you define your PV/PVC. From my experience it is pretty easy to use NFS based PV to retain data between pod recreations deletions. I go with following approach for NFS volume shared by multiple pods.</p>

<p>Volume :</p>

<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pvname
spec:
  capacity:
    storage: 1Mi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  nfs:
    server: &lt;nfs IP&gt;
    path: &lt;nfs path&gt;
</code></pre>

<p>Claim :</p>

<pre><code>kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: pvcname
spec:
  volumeName: pvname
  accessModes:
  - ReadWriteMany
  resources:
    requests:
      storage: 1Mi
</code></pre>

<p>This ensured that whatever I delete in k8s I can get back to my data on a known path on NFS server as well as reuse it again by recreating PV/PVC/POD on k8s, hence it should survive all three cases you mentioned.</p>
