<p>I have a <strong>StatefulSet-1</strong> running with 3 replicas &amp; each pod writing logs to its own persistent volume say <strong>pv1,pv2,pv3</strong> (achieved using <strong>volumeClaimTemplates:</strong>)</p>

<p>I have another <strong>StatefulSet-2</strong> running with 3 replicas &amp; I want each POD of <strong>StatefulSet-2</strong> access already created <strong>StatefulSet-1</strong>'s volumes i.e. <strong>pv1,pv2 &amp; pv3</strong> for processing seperate logs written by each pod of <strong>StatefulSet-1</strong>.</p>

<p>So <strong>pv1,pv2,pv3</strong> should be using by both <strong>StatefulSet1</strong> &amp; <strong>StatefulSet2</strong> since <strong>pv1,pv2,pv3</strong> created as part of <strong>StatefulSet-1</strong> deployment! pv1,pv2,pv3 will ofcourse takes POD's name of <strong>StatefulSet-1</strong> which is ok for <strong>StatefulSet-2</strong>.</p>

<p>How to configure <strong>StatefulSet2</strong> to achieve the above scenario? please help!</p>

<p>Thanks &amp; Regards,
Sudhir</p>

sudhir tataraju
<p>This won't work. 
1. PVs backed by GCE disks are in readWriteOnce mode so 1 pvc per pod.
2. You are achieving the statefulset pods with PVCs using PVC templates which rely on dynamic volume provisioning to create the appropriate PVs and PVCs.</p>

<p>If you need these pods to share the PVC, your best bet is to use a readWriteMany PV such as one backed by NFS. You will also need to create the pods of statefulSet-2 manually to have them mount the appropriate PVCs. You could achieve this by creating a single pod deployment for each one.</p>

<p>Something else to consider, can you have the containers of each statefulSet run together in the same pods? Normally this is not recommended, but it would allow them both to share the same volumes (as long as they are not using the same ports)</p>
