locked
How to mount cassandra data location to azure file share using stateful set kubernetes RRS feed

  • Question

  • 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.

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

    I have tried the following steps given below, finding difficulty in volumeClaimTemplates
    --
    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==

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

    I want mount /var/lib/cassandra/data folder of every node into azure file share...dnt know i have to make 3 azure file share or single azure file share will manage it.

       
    • Edited by suraj1287 Monday, April 8, 2019 9:49 AM
    Monday, April 8, 2019 9:46 AM

All replies

  • Similar issue has been discussed in SO thread. You may try and see if it helps.

    Monday, April 8, 2019 12:39 PM
  • myself asked that question in stackoverflow
    Wednesday, April 10, 2019 8:42 AM
  • This question would be more suitable in the Kubernetes Compute forums, but I noticed in the official documentation

    That you need to create a pod(Kind) not a persistent volume, this should help make some changes. Let me know if this helps.

    Thursday, April 11, 2019 9:27 PM