<p>I have installed minikube on local windows machine. Trying to install redis cluster.
I ran all cluster using <code>kubectl create -f &lt;resource&gt; -n &lt;namespace&gt;</code>. Following are the files that were used to create clusters.</p>
<ol>
<li>Storage class</li>
</ol>
<pre><code>apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
reclaimPolicy: Delete
</code></pre>
<ol start="2">
<li>Persistent volumes.</li>
</ol>
<pre><code>kind: PersistentVolume
metadata:
  name: local-pv1
spec:
  storageClassName: local-storage
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/storage/data1&quot;

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-pv2
spec:
  storageClassName: local-storage
  capacity:
    storage: 1Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/storage/data2&quot;

---

apiVersion: v1
kind: PersistentVolume
metadata:
  name: local-pv3
spec:
  storageClassName: local-storage
  capacity:
    storage: 2Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: &quot;/storage/data3&quot;
</code></pre>
<ol start="3">
<li>Redis config map</li>
</ol>
<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: redis-cluster
  labels:
    app: redis-cluster
data:
  fix-ip.sh: |
    #!/bin/sh
    CLUSTER_CONFIG=&quot;/data/nodes.conf&quot;
    echo &quot;creating nodes&quot;
    if [ -f ${CLUSTER_CONFIG} ]; then
      echo &quot;[ INFO ]File:${CLUSTER_CONFIG} is Found&quot;
    else
      touch $CLUSTER_CONFIG
    fi
    if [ -z &quot;${POD_IP}&quot; ]; then
      echo &quot;Unable to determine Pod IP address!&quot;
      exit 1
    fi
    echo &quot;Updating my IP to ${POD_IP} in ${CLUSTER_CONFIG}&quot;
    sed -i.bak -e &quot;/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/${POD_IP}/&quot; ${CLUSTER_CONFIG}
    echo &quot;done&quot;
    exec &quot;$@&quot;
  redis.conf: |+
    cluster-enabled yes
    cluster-require-full-coverage no
    cluster-node-timeout 15000
    cluster-config-file /data/nodes.conf
    cluster-migration-barrier 1
    appendonly yes
    protected-mode no
</code></pre>
<ol start="4">
<li>Statefulset redis cluster</li>
</ol>
<pre><code>apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis
spec:
  serviceName: redis
  replicas: 3
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      labels:
        app: redis
    spec:
      initContainers:
      - name: config
        image: redis:6.2.3-alpine
        command: [ &quot;sh&quot;, &quot;-c&quot; ]
        args:
          - |
            cp /tmp/redis/redis.conf /etc/redis/redis.conf
            
            echo &quot;finding master...&quot;
            MASTER_FDQN=`hostname  -f | sed -e 's/redis-[0-9]\./redis-0./'`
            if [ &quot;$(redis-cli -h sentinel -p 5000 ping)&quot; != &quot;PONG&quot; ]; then
              echo &quot;master not found, defaulting to redis-0&quot;

              if [ &quot;$(hostname)&quot; == &quot;redis-0&quot; ]; then
                echo &quot;this is redis-0, not updating config...&quot;
              else
                echo &quot;updating redis.conf...&quot;
                echo &quot;slaveof $MASTER_FDQN 6379&quot; &gt;&gt; /etc/redis/redis.conf
              fi
            else
              echo &quot;sentinel found, finding master&quot;
              MASTER=&quot;$(redis-cli -h sentinel -p 5000 sentinel get-master-addr-by-name mymaster | grep -E '(^redis-\d{1,})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')&quot;
              echo &quot;master found : $MASTER, updating redis.conf&quot;
              echo &quot;slaveof $MASTER 6379&quot; &gt;&gt; /etc/redis/redis.conf
            fi
        volumeMounts:
        - name: redis-config
          mountPath: /etc/redis/
        - name: config
          mountPath: /tmp/redis/
      containers:
      - name: redis
        image: redis:6.2.3-alpine
        command: [&quot;redis-server&quot;]
        args: [&quot;/etc/redis/redis.conf&quot;]
        ports:
        - containerPort: 6379
          name: redis
        volumeMounts:
        - name: data
          mountPath: /data
        - name: redis-config
          mountPath: /etc/redis/
      volumes:
      - name: redis-config
        emptyDir: {}
      - name: config
        configMap:
          name: redis-config
  volumeClaimTemplates:
  - metadata:
      name: data
    spec:
      accessModes: [ &quot;ReadWriteOnce&quot; ]
      storageClassName: &quot;local-storage&quot;
      resources:
        requests:
          storage: 500Mi
</code></pre>
<ol start="5">
<li>Head less redis service</li>
</ol>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: redis-cluster
  namespace: redis
spec:
  type: ClusterIP
  ports:
  - port: 6379
    targetPort: 6379
    name: client
  - port: 16379
    targetPort: 16379
    name: gossip
  selector:
    app: redis-cluster
</code></pre>
<p>This is what comes on getting pods</p>
<pre><code>redis-cluster-0   0/1     Pending   0          2d 
</code></pre>
<p>On describing the pods this is the message shown. Not sure if this is an issue</p>
<pre><code>Warning  FailedScheduling  6m24s (x110 over 46h)  default-scheduler  0/1 nodes are available: 1 pod has unbound immediate PersistentVolumeClaims. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
</code></pre>

Prakash
<p>It's likely that your cluster has no <code>storageClassName: local-storage</code>. Check your storage classes using <code>kubectl get sc</code>. To fix this, you need to do any of the following:</p>
<ol>
<li>Create a storage class called <code>local-storage</code></li>
<li>Modify your manifest file's storage-class field to any pre-existing SC.</li>
</ol>
