<p>I want to share multiple volumes using PersistentVolume reqource of kubernetes.</p>
<p>I want to share &quot;/opt/*&quot; folders in pod. But not the &quot;/opt&quot;:</p>
<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: demo
  namespace: demo-namespace
  labels:
    app: myApp
    chart: &quot;my-app&quot;
    name: myApp
spec:
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: &quot;myApp-data&quot;
  hostPath:
    path: /opt/*
</code></pre>
<p>But in pod I am not able to see shared volume. If I share only &quot;/opt&quot; folder then it goes shown
in pod.</p>
<p>Is there anything I am missing?</p>

<p>If you want to share a folder among some pods or deployments or statefulsets  you should create PersistentVolumeClaim and it's access mode should be ReadeWriteMany.So here is an example of PersistentVolumeClaim  which has ReadeWriteMany  mode</p>
<pre><code>apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: task-pv-claim
spec:
accessModes:
  - ReadWriteMany
resources:
  requests:
    storage: 3Gi
</code></pre>
<p>then in your pods  you should use it as below ...</p>
<pre><code>    apiVersion: v1
    kind: Pod
    metadata:
      name: mypod01
    spec:
      volumes:
        - name: task-pv-storage
          persistentVolumeClaim:
            claimName: task-pv-claim
      containers:
        - name: c01
          image: alpine
          volumeMounts:
            - mountPath: &quot;/opt&quot;
              name: task-pv-storage
</code></pre>
<pre><code>    apiVersion: v1
    kind: Pod
    metadata:
      name: mypod02
    spec:
      volumes:
        - name: task-pv-storage
          persistentVolumeClaim:
            claimName: task-pv-claim
      containers:
        - name: c02
          image: alpine
          volumeMounts:
            - mountPath: &quot;/opt&quot;
              name: task-pv-storage
</code></pre>
