REDIS cluster without persistence on KUBERNETES

10/19/2019

I am trying to setup a redis cluster without persistence on a kubernetes cluster. Is there a way I can do that without persistence volume. I need auto recovery after pod reboot. is there an easy way to do that ?

Tried out updating node info with a script on startup which doesn't really work as the rebooted pod comes up with a new static private ip. fyi i have created a stateful set and a configmap referred here: https://github.com/rustudorcalin/deploying-redis-cluster and the empty dir setup for volumes. ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/

-- Irshad K
kubernetes
redis

2 Answers

10/19/2019

You cannot do this, the state of your redis is lots when a pod is restarted. Even with persistence storage is not so easy. You will need some kind of orchestration to manage and reconnect Redis.

-- FL3SH
Source: StackOverflow

10/19/2019

Do you mean actual cluster mode or just running Redis in general without persistence? This is what I usually use.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ...
  namespace: ...
  labels:
    app.kubernetes.io/name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: redis
  template:
    metadata:
      labels:
        app.kubernetes.io/name: redis
    spec:
      containers:
      - name: default
        image: redis:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 6379
        args:
        - "--save"
        - ""
        - "--appendonly"
        - "no"
-- coderanger
Source: StackOverflow