<p>Could someone help me please and point me what configuration should I be doing for my use-case?</p>
<p>I'm building a development k8s cluster and one of the steps is to generate security files (private keys) that are generated in a number of pods during deployment (let's say for a simple setup I have 6 pods that each build their own security keys). I need to have access to all these files, also they must be persistent after the pod goes down.</p>
<p>I'm trying to figure out now how to set up it locally for internal testing. From what I understand Local PersistentVolumes only allow 1:1 with PersistentVolumeClaims, so I would have to create a separate PersistentVolume and PersistentVolumeClaim for each pod that get's configured. I would prefer to void this and use one PersistentVolume for all.</p>
<p>Could someone be so nice and help me or point me to the right setup that should be used?</p>
<p><strong>-- Update: 26/11/2020</strong>
So this is my setup:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hlf-nfs--server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hlf-nfs--server
  template:
    metadata:
      labels:
        app: hlf-nfs--server
    spec:
      containers:
        - name: hlf-nfs--server
          image: itsthenetwork/nfs-server-alpine:12
          ports:
            - containerPort: 2049
              name: tcp
            - containerPort: 111
              name: udp
          securityContext:
            privileged: true
          env:
            - name: SHARED_DIRECTORY
              value: &quot;/opt/k8s-pods/data&quot;
          volumeMounts:
            - name: pvc
              mountPath: /opt/k8s-pods/data
      volumes:
        - name: pvc
          persistentVolumeClaim:
            claimName: shared-nfs-pvc
</code></pre>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: hlf-nfs--server
  labels:
    name: hlf-nfs--server
spec:
  type: ClusterIP
  selector:
    app: hlf-nfs--server
  ports:
    - name: tcp-2049
      port: 2049
      protocol: TCP
    - name: udp-111
      port: 111
      protocol: UDP
</code></pre>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: shared-nfs-pvc
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs
  resources:
    requests:
      storage: 1Gi
</code></pre>
<p>These three are being created at once, after that, I'm reading the IP of the service and adding it to the last one:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: shared-nfs-pv
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteMany
  nfs:
    path: /opt/k8s-pods/data
    server: &lt;&lt;-- IP from `kubectl get svc -l name=hlf-nfs--server`
</code></pre>
<p>The problem I'm getting and trying to resolve is that the PVC does not get bound with the PV and the deployment keeps in READY mode.</p>
<p>Did I miss anything?</p>

Sniady
<p>It is correct that there is a 1:1 relation between a <code>PersistentVolumeClaim</code> and a <code>PersistentVolume</code>.</p>
<p>However, Pods running on the same Node can concurrently mount the same volume, e.g. use the same <code>PersistentVolumeClaim</code>.</p>
<p>If you use Minikube for local development, you only have one node, so you can use the same <code>PersistentVolumeClaim</code>. Since you want to use different files for each app, you could use a <em>unique directory</em> for each app in that shared volume.</p>
