<p>I am setting up 3 node Cassandra cluster on Azure using Statefull set Kubernetes and not able to mount data location in azure file share.</p>

<p>I am able to do using default kubenetes storage but not with Azurefile share option.</p>

<p>I have tried the following steps given below, finding difficulty in volumeClaimTemplates</p>

<pre><code>apiVersion: "apps/v1"
kind: StatefulSet
metadata:
  name: cassandra
  labels:
    app: cassandra
spec:
  serviceName: cassandra
  replicas: 3
  selector:
    matchLabels:
      app: cassandra
  template:
    metadata:
      labels:
        app: cassandra
    spec:
      containers:
        - name: cassandra
          image: cassandra
          imagePullPolicy: Always
          ports:
            - containerPort: 7000
              name: intra-node
            - containerPort: 7001
              name: tls-intra-node
            - containerPort: 7199
              name: jmx
            - containerPort: 9042
              name: cql
          env:
            - name: CASSANDRA_SEEDS
              value: cassandra-0.cassandra.default.svc.cluster.local
            - name: MAX_HEAP_SIZE
              value: 256M
            - name: HEAP_NEWSIZE
              value: 100M
            - name: CASSANDRA_CLUSTER_NAME
              value: "Cassandra"
            - name: CASSANDRA_DC
              value: "DC1"
            - name: CASSANDRA_RACK
              value: "Rack1"
            - name: CASSANDRA_ENDPOINT_SNITCH
              value: GossipingPropertyFileSnitch
            - name: POD_IP
              valueFrom:
                fieldRef:
                   fieldPath: status.podIP                 
          volumeMounts:
          - mountPath: /var/lib/cassandra/data
            name: pv002
  volumeClaimTemplates:
  - metadata:
      name: pv002
    spec:
      storageClassName: default
      accessModes:
        - ReadWriteOnce
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv002
  accessModes:
  - ReadWriteOnce
  azureFile:
    secretName: storage-secret
    shareName: xxxxx
    readOnly: false
  claimRef:
    namespace: default
    name: az-files-02
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: az-files-02
spec:
  accessModes:
    - ReadWriteOnce
---
apiVersion: v1
kind: Secret
metadata:
  name: storage-secret
type: Opaque
data:
  azurestorageaccountname: xxxxx
  azurestorageaccountkey: jjbfjbsfljbafkljasfkl;jf;kjd;kjklsfdhjbsfkjbfkjbdhueueeknekneiononeojnjnjHBDEJKBJBSDJBDJ==
</code></pre>

<p>I should able to mount data folder of each cassandra node into azure file share.</p>

<p>For using azure file in statefulset, I think you could following this example: <a href="https://github.com/andyzhangx/demo/blob/master/linux/azurefile/attach-stress-test/statefulset-azurefile1-2files.yaml" rel="nofollow noreferrer">https://github.com/andyzhangx/demo/blob/master/linux/azurefile/attach-stress-test/statefulset-azurefile1-2files.yaml</a></p>
