1

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 ?

mchawre
  • 10,744
  • 4
  • 35
  • 57
bilal_khan
  • 79
  • 2
  • 9

2 Answers2

0

Did you create correct storage class and named it fast?

Try with this one (should work on azure):

...
  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
  • 2,996
  • 1
  • 17
  • 25
  • I used a followed your advice and created the fast StorageClass, to no avail: Warning FailedScheduling 11s (x3 over 81s) default-scheduler error while running "VolumeBinding" filter plugin for pod "cassandra-0": pod has unbound immediate PersistentVolumeClaims. I think it is a RBAC security issue but I dont know how to debug it – Rubber Duck Sep 16 '20 at 07:46
  • What is your cloud provider? – FL3SH Sep 16 '20 at 08:15
  • EKS on AWS (by the way I just managed to use helm incubator chart with helm 2). kubectl create serviceaccount --namespace kube-system tiller kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller – Rubber Duck Sep 16 '20 at 08:28
  • I do not recommend helm 2 for security reasons - you just gave tiller full access to your cluster, check if you could install it with helm3. – FL3SH Sep 16 '20 at 08:45
  • Good point, For now it is a POC and I had trouble with Helm 3 on Mac so it will do for now. Do you have an answer to the Plain yaml statefulset conundrum? I'm sure it's some kind of rolebinding mess – Rubber Duck Sep 16 '20 at 09:00
  • Take your time and make use of helm3, I am using it on mac and it works great - installed via brew. – FL3SH Sep 17 '20 at 10:05
  • `Do you have an answer to the Plain yaml statefulset conundrum?` sorry, can you explain I don't get it? – FL3SH Sep 17 '20 at 10:06
  • Why does the yaml example in the question not work on EKS or docker with the respective storage class modified to the specific kubernetes deployment. I suspect rbac security nonsense – Rubber Duck Sep 18 '20 at 11:53
  • As you can see above in my example I have `provisioner: kubernetes.io/azure-disk`, every cloud provider has its own `provisioner` and this is why you cannot run it on aws. – FL3SH Sep 21 '20 at 08:35
  • on docker for descktop provisioner: docker.io/hostpath on aws provisioner: kubernetes.io/aws-ebs don't work – Rubber Duck Sep 21 '20 at 10:08
0

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://learn.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv

then you can associate the object with your StatefulSet

cperez08
  • 709
  • 4
  • 9