I am creating redis-cluster on kube with aws-gp2 persistent volume. I was using redis-cluster.yml
I have created Storage Class according to this doc, for dynamic persistence volume creation
This is my StorageClass definition
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: aws-gp2
provisioner: kubernetes.io/aws-ebs
parameters:
type: gp2
zones: us-west-2a, us-west-2b, us-west-2c
fsType: ext4
reclaimPolicy: Retain
allowVolumeExpansion: true
When I try to create cluster volume creation stuck at pending
state, after checking logs found this
$ kubectl -n staging describe pvc data-redis-cluster-0
Name: data-redis-cluster-0
Namespace: staging
StorageClass:
Status: Pending
Volume:
Labels: app=redis-cluster
Annotations: <none>
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal FailedBinding 13s (x11 over 2m) persistentvolume-controller no persistent volumes available for this claim and no storage class is set
and events
$ kubectl -n staging get events
LAST SEEN FIRST SEEN COUNT NAME KIND SUBOBJECT TYPE REASON SOURCE MESSAGE
10s 10s 1 redis-cluster.15816c6dc1d6c03a StatefulSet Normal SuccessfulCreate statefulset-controller create Claim data-redis-cluster-0 Pod redis-cluster-0 in StatefulSet redis-cluster success
10s 10s 1 redis-cluster.15816c6dc2226fe0 StatefulSet Normal SuccessfulCreate statefulset-controller create Pod redis-cluster-0 in StatefulSet redis-cluster successful
8s 10s 3 data-redis-cluster-0.15816c6dc1dfd0cb PersistentVolumeClaim Normal FailedBinding persistentvolume-controller no persistent volumes available for this claim and no storage class is set
3s 10s 5 redis-cluster-0.15816c6dc229258d Pod Warning FailedScheduling default-scheduler pod has unbound PersistentVolumeClaims (repeated 4 times)
someone point out what is wrong here ?
Since cluster doesn't have default StorageClass
, I had to add storageClassName: aws-gp2
to volumeClaimTemplates
, which helped me to fix this issue
like this
volumeClaimTemplates:
- metadata:
namespace: staging
name: data
labels:
name: redis-cluster
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: aws-gp2
resources:
requests:
storage: 100Mi