Home > Net >  How to get RedisInsight working on Kubernetes with PersistentVolumeClaim instead of EmptyDir?
How to get RedisInsight working on Kubernetes with PersistentVolumeClaim instead of EmptyDir?

Time:10-25

How to get RedisInsight working with PersistentVolumeClaims?

I installed RedisInsight following the docs and the Pod starts normally and is available via the created Service, if the deployment.yaml uses emptyDir. Therefore, my question differs from redisinsights-with-persistent-volume-in-kubernetes, where the Service was the issue.

However, if I add a peristentVolumeClaim the Pod starts and data is added to the mounted directory (i.e., it is an nfs share, with mod 777 and user/group 1001:1001 ownership), but RedisInsight is not accessible anymore (local on the Pod and externally via the Service).

I used the similar yaml files for other deployments and there they worked as expected.

The RedisInsight logs are empty.

deployment.yaml


apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: redis-insight
  name: redis-insight
  namespace: default
spec:
  replicas: 1
  selector: 
    matchLabels:
      app: redis-insight
  template:
    metadata:
      labels:
        app: redis-insight
    spec:
      containers:
      - image: redislabs/redisinsight:latest
        name: redis-insight
        env:
          - name: RIHOST
           value: 0.0.0.0
          - name: RIPORT
            value:  "8001"
          - name: RIHOMEDIR
            value: /db
          - name: RILOGDIR
            value: /db
        volumeMounts:
          - name: db 
            mountPath: /db
        ports:
        - containerPort: 8001
          name: redis-ui-port
      volumes:
        - name: db
          # emptyDir: {}
          persistentVolumeClaim:
            claimName: pvc-nfs-redis-insight

service.yaml

apiVersion: v1
kind: Service
metadata:
  name: redis-insight-service-loadbalancer
spec:
  type: LoadBalancer
  selector:
    app: redis-insight
  ports:
  - port: 8001
    targetPort: 8001
    protocol: TCP
    name: redis-ui-port

persistent-volume-claim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-nfs-redis-insight
spec:
  storageClassName: nfs
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi

persistent-volume.yaml


apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv-nfs-redis-insight
  labels:
    type: nfs
spec:
  storageClassName: nfs
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  nfs:
    path: /srv/redis-insight/
    server: nfs.local
    readOnly: false

data dir on nfs-server (exported as srv/redis-insight):

/mnt/redis-insight$ ls -aln
total 24
drwxrwxrwx 6 1001 1001 4096 Okt 22 15:17 .
drwxr-xr-x 6 1000 1000 4096 Okt 22 15:16 ..
drwxr-xr-x 2 1001 1001 4096 Okt 22 15:17 bulk_operation
drwxr-xr-x 2 1001 1001 4096 Okt 22 15:17 dropbox
drwxr-xr-x 2 1001 1001 4096 Okt 22 15:17 profiler_logs
-rw-r--r-- 1 1001 1001    0 Okt 22 15:17 queries.log
-rw-r--r-- 1 1001 1001    0 Okt 22 15:17 redisinsight.db
-rw-r--r-- 1 1001 1001    0 Okt 22 15:17 redisinsight.log
drwxr-xr-x 2 1001 1001 4096 Okt 22 15:17 rsnaps

CodePudding user response:

I am a Product Manager at RedisInsight, we will look into this issue in this ticket in RedisInsight repository: https://github.com/RedisInsight/RedisInsight/issues/1315

CodePudding user response:

As described here it is not a RedisInsight issue. Rather the issue emerged from NFS PersistentVolume not supporting the Pod SecurityContext.

I could resolve my issue by using csi-driver-nfs instead. Detailed installation instructions can be found here.

  • Related