Deploying Cassandra on kubernetes cluster

8/5/2019

I have been trying to deploy Cassandra using following documentation https://kubernetes.io/docs/tutorials/stateful-application/cassandra/

deployment of Cassandra works fine but when i try to create statefull set it gives following error :

Cassandra 0 pod has unbound immediate PersistentVolumeClaims (repeated 2 times)

can any one help me where am i doing wrong ?

-- bilal_khan
azure
cassandra
kubernetes

2 Answers

8/5/2019

Did you create correct storage class and named it fast?

Try with this one:

...
  volumeClaimTemplates:
  - metadata:
      name: cassandra-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: fast
      resources:
        requests:
          storage: 1Gi

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast
parameters:
  fsType: xfs
  kind: Managed
  storageaccounttype: Premium_LRS
provisioner: kubernetes.io/azure-disk
reclaimPolicy: Delete
volumeBindingMode: Immediate
-- FL3SH
Source: StackOverflow

8/5/2019

A stateful set requires a persistent volume where store the state, the docs you provide there is a section that shows it:

 volumeClaimTemplates:
  - metadata:
      name: cassandra-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: fast
      resources:
        requests:
          storage: 1Gi
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: fast
provisioner: k8s.io/minikube-hostpath
parameters:
  type: pd-ssd

these are the docs to create a PV and/or Storage class in Azure as you need

https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv

then you can associate the object with your StatefulSet

-- cperez08
Source: StackOverflow