oblakstudio / redisinsight

RedisInsight v2 - Better GUI for Redis (amd64/arm64)
https://hub.docker.com/r/oblakstudio/redisinsight
Other
65 stars 7 forks source link

Unable to persist connection data inside Kubernetes #19

Open djordjekrsmanovic opened 7 months ago

djordjekrsmanovic commented 7 months ago

Hello, I have problem to persist connection data. Looks like when pod of redisinsight restarts, it lose all connections to redis databases.

This is configuration for pod

# RedisInsight deployment with name 'redisinsight'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redisinsight #deployment name
  labels:
    app: redisinsight #deployment label
spec:
  replicas: 1 #a single replica pod
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: redisinsight #which pods is the deployment managing, as defined by the pod template
  template: #pod template
    metadata:
      labels:
        app: redisinsight #label for pod/s
    spec:
      volumes:
        - name: db
          persistentVolumeClaim:
            claimName: redisinsight-pv-claim
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
        fsGroupChangePolicy: "OnRootMismatch"
      containers:
        - name:  redisinsight #Container name (DNS_LABEL, unique)
          image: oblakstudio/redisinsight:3.0 #repo/image
          imagePullPolicy: IfNotPresent #Always pull image
          volumeMounts:
          - name: db #Pod volumes to mount into the container's filesystem. Cannot be updated.
            mountPath: "/data"
          securityContext:
            privileged: false
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            runAsUser: 1000
            runAsGroup: 1000
            capabilities:
              drop:
              - ALL

Thank you in advance!

ledouxpl commented 6 months ago

I have the exact same problem.

ledouxpl commented 6 months ago

Found it.... this image persists into /home/node/.redisinsight-app instead of ./data.

germanattanasio commented 6 months ago

@djordjekrsmanovic, is your deployment working? I copied your definition, but it doesn't seem to start. I see nothing in the logs either.

I want to disable SERVER_TLS, which I don't think is the problem in my case, but it's the only difference from your setup above.

Can someone share their deployment/stateful set setup?

djordjekrsmanovic commented 6 months ago

@germanattanasio Deployment is working. I will check issue with data persistence again.

germanattanasio commented 6 months ago

Thanks, @djordjekrsmanovic. I ended up switching to the official Docker image from Redis. It seems like they finally got their act together. I use a StatefulSet, but I think a Deployment would work too.

I took into account a baseline for PSA so you see I'm running as non root and all the fancy stuff

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: d1-redis-insight
  labels:
    chart: moveo-1.0.0
    release: d1
    heritage: Helm
    component: d1-redis-insight
spec:
  serviceName: d1-redis-insight
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  selector:
    matchLabels:
      component: redis-insight-v2
      release: d1
  template:
    metadata:
      labels:
        component: redis-insight-v2
        release: d1
    spec:
      hostNetwork: false
      hostPID: false
      hostIPC: false
      securityContext:
        fsGroup: 1000
      containers:
        - name: redis-insight-v2
          image: "redis/redisinsight:2.48.0"
          imagePullPolicy: IfNotPresent
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
            seccompProfile:
              type: RuntimeDefault
          ports:
            - name: http
              containerPort: 5000
              protocol: TCP
          livenessProbe:
           httpGet:
             path: /
             port: http
          readinessProbe:
           httpGet:
             path: /
             port: http
          env:
            - name: NODE_ENV
              value: production
            - name: RI_APP_PORT
              value: "5000"
            - name: RI_LOG_LEVEL
              value: debug
            - name: RI_FILES_LOGGER
              value: 'false'
          resources:
            limits:
              memory: 450Mi
            requests:
              cpu: 100m
              memory: 400Mi
          volumeMounts:
            - name: data
              mountPath: /data
            - name: temp-volume
              mountPath: /home/node/.redisinsight-app
      volumes:
        - name: temp-volume
          emptyDir: {}
  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: 2Gi