<p>I was trying to install a Cassandra stateful set on our k8s cluster. We want to mount an AWS EFS to all the Cassandra pods. And during configuring the volumes, I found we have 2 ways of declaring the volumes.</p>
<ol>
<li>Create an EFS, install <a href="https://github.com/helm/charts/tree/master/stable/efs-provisioner" rel="nofollow noreferrer">efs-provisioner</a> (a persistentVolume provisioner plugin) on our cluster, create a <code>PersistentVolume</code> with the EFS-provisioner, and use <code>volumeClaimTemplates</code> (I think it actually means persistentVolumeClaimTemplates, I don' know why they ignore the persistent prefix) in pod templates. Like this :</li>
</ol>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: hello-openshift-nfs-pod 
  labels:
    name: hello-openshift-nfs-pod
spec:
  containers:
    - name: hello-openshift-nfs-pod
      image: openshift/hello-openshift 
      ports:
        - name: web
          containerPort: 80
      volumeMounts:
        - name: nfsvol 
          mountPath: /usr/share/nginx/html 
  securityContext:
      supplementalGroups: [100003] 
      privileged: false
  volumes:
    - name: nfsvol
      persistentVolumeClaim:
        claimName: nfs-pvc 

</code></pre>
<p>(code from a <a href="https://docs.okd.io/latest/install_config/storage_examples/shared_storage.html" rel="nofollow noreferrer">article</a>)</p>
<ol start="2">
<li>Or I can mount the EFS directly to my Cassandra pods :</li>
</ol>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: hello-openshift-nfs-pod 
  labels:
    name: hello-openshift-nfs-pod
spec:
  containers:
    - name: hello-openshift-nfs-pod
      image: openshift/hello-openshift 
      ports:
        - name: web
          containerPort: 80
      volumeMounts:
        - name: nfsvol 
          mountPath: /usr/share/nginx/html 
  securityContext:
      supplementalGroups: [100003] 
      privileged: false
  volumes:
    - name: cassandra-shared-volume
      nfs:
        server: &lt;EFS file system endpoint url&gt;
        path: &quot;/cassandra/shared&quot;

</code></pre>
<p>So for me, method 1 is just like wrap the nfs(EFS in this case) in a persistentVolume. I don't know what is the major benefits of method 1 though it is almost how every team use nfs. There is   a short answer on <code>efs-provisioner</code> FAQ : they says</p>
<blockquote>
<p>I noticed the EFS gets mounted directly to the efs-provisioner container, can I do that for my apps?
Yes you can but it's not recommended. You lose the reusability of the StorageClass to be able to dynamically provision new PersistentVolumes for new containers and pods.</p>
</blockquote>
<p>This answer is fine but I am wondering if there is any implicts behind <code>persistentVolume</code> than <code>volume</code> alone. There is <code>StatefulSet</code> doc saying :</p>
<blockquote>
<p>The storage for a given Pod must either be provisioned by a PersistentVolume Provisioner based on the requested storage class, or pre-provisioned by an admin.</p>
</blockquote>
<p>So I am wondering whether s StatefulSet must have a storage type of: PersistentVolume. The major conflicts is , unlike block storage, EFS itself is persistent and it's dynamic scaling ability is already handled by AWS and doesn't need <code>persistentVolumeProvisioner</code> to create new resources.</p>
<p>I want to know is there any major benefit of method 1 or flaw in method 2 that I must use method 1?</p>

<p>Use of SAN and network filesystems like EFS is <a href="https://www.datastax.com/dev/blog/impact-of-shared-storage-on-apache-cassandra" rel="nofollow noreferrer">not recommended for Cassandra</a> in general, due to performance concerns. Depending on the workflows, you can get acceptable performance with ephemeral (instance) storage vs EBS, as explained <a href="https://aws.amazon.com/blogs/big-data/best-practices-for-running-apache-cassandra-on-amazon-ec2/" rel="nofollow noreferrer">here</a>.</p>

<p>Adding the containers layer has not prevented those issues, at this moment we're conducting a similar Proof of Concept setting a write-intensive scenario, and we have been able to get some acceptable performance using i3 instances and ephemeral storage for the PersistentVolumes definition, but this is not a definitive response yet as we continue looking for the right configuration for our purposes.</p>
