skip to Main Content

I am trying to run a Redis cluster on Kubernetes. I am not planning to persist any Redis data to the disk. Is it possible to run the Redis cluster as Kubernetes deployment and not as a stateful set?

2

Answers


  1. Yes, though I would probably still use StatefulSet specifically for the features to ensure only one pod starts at a time.

    Login or Signup to reply.
  2. yes it is possible to persist data in PVC with stateful sets, however in helm chart for HA redis cluster they are using stateful sets only :

    apiVersion: v1
    kind: Service
    metadata:
      name: redis
    spec:
      ports:
        - port: 6379
          name: redis
      clusterIP: None
      selector:
        app: redis
    ---
    apiVersion: apps/v1beta2
    kind: StatefulSet
    metadata:
      name: redis
    spec:
      selector:
        matchLabels:
          app: redis  
      serviceName: redis
      replicas: 1
      template:
        metadata:
          labels:
            app: redis 
        spec:
          containers:
            - name: redis
              image: redislabs/redis
              args: ["--requirepass", "admin", "--appendonly", "yes", "--save", "900", "1", "--save", "30", "2"]
              ports:
                - containerPort: 6379
                  name: redis
              resources:
                limits:
                  cpu: .50
                  memory: 1500Mi
                requests:
                  cpu: .25
                  memory: 1024Mi
              volumeMounts:
                - name: redis-volume
                  mountPath: /data
      volumeClaimTemplates:
      - metadata:
          name: redis-volume
        spec:
          accessModes: [ "ReadWriteOnce" ]
          resources:
            requests:
              storage: 20Gi
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search