Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to persist connection data inside Kubernetes #19

Open
djordjekrsmanovic opened this issue Mar 15, 2024 · 5 comments
Open

Unable to persist connection data inside Kubernetes #19

djordjekrsmanovic opened this issue Mar 15, 2024 · 5 comments

Comments

@djordjekrsmanovic
Copy link

djordjekrsmanovic commented Mar 15, 2024

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
Copy link

ledouxpl commented Apr 2, 2024

I have the exact same problem.

@ledouxpl
Copy link

ledouxpl commented Apr 2, 2024

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

@germanattanasio
Copy link

@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
Copy link
Author

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

@germanattanasio
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants