sanderploegsma / redis-cluster

Redis Cluster setup running on Kubernetes
https://sanderp.nl/running-redis-cluster-on-kubernetes-e451bda76cad
MIT License
244 stars 132 forks source link

Storage class missing #11

Open kjenney opened 5 years ago

kjenney commented 5 years ago

First of all - THANKS! You saved me a bunch of time!

I had an issue with deploying the cluster initially and thought I'd share it. I don't have a complete understanding of deploying Kubernetes outside of EKS and local - so this could just be something that's assumed:

I deployed the cluster to a namespace (redis-example) on my local machine

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-28T20:03:09Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.3", GitCommit:"2bba0127d85d5a46ab4b778548be28623b32d0b0", GitTreeState:"clean", BuildDate:"2018-05-21T09:05:37Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

$ kubectl get pods -n redis-example
NAME              READY     STATUS    RESTARTS   AGE
redis-cluster-0   0/1       Pending   0          38m

$ kubectl get pvc -n redis-example
NAME                   STATUS    VOLUME    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
data-redis-cluster-0   Pending                                                      38m

$ kubectl describe pvc/data-redis-cluster-0 -n redis-example
Name:          data-redis-cluster-0
Namespace:     redis-example
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  4m (x143 over 39m)  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set

I saw the same thing when deploying this in EKS. I ended up setting the storage class in the yaml:

  volumeClaimTemplates:
  - metadata:
      name: data
      labels:
        name: redis-cluster
      namespace: redis-example
    spec:
      storageClassName: default
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 100Mi

Now it deploys fine in EKS. Local still failed until I defined a StorageClass there (named default). For newbies it would be useful to add this to the README. Thanks again. ......

sanderploegsma commented 5 years ago

Hi @kjenney, thanks for reporting this! Yes, I was kind of aware that this setup is not plug-and-play on different providers, I only set it up on Minikube and on GKE. For the latter I also needed to specify a storage class IIRC, which broke the local setup. I therefore decided to omit it from the tutorial, because I figured it would be different for each provider, which would only cause more confusion.

If all providers support the storage class default, it might make sense to update the tutorial, noting that you need to create it yourself when running on Minikube.

khteh commented 5 years ago

I use ubuntu/microk8s and this is taken care of by microk8s.enable storage