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

Redis on K8s, modules are not loading. #50

Open
ghost opened this issue Jan 26, 2023 · 2 comments
Open

Redis on K8s, modules are not loading. #50

ghost opened this issue Jan 26, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 26, 2023

Hello RedisLabs community! I've begun using Redis for caching data, and found this repo with all the modules I needed, which was beautiful, congrats on the project.

When I used this with docker build and compose, it worked perfectly, loading the modules according to the expected, but when I tried using this image on a Kubernetes cluster, I was able to spin up the server but the modules were not loaded.

The main module I'm trying to use is RedisJSON, and I've got a unknown command JSON.GET and `unknown command `JSON.SET when attempting to get cached data or cache new data.

The yaml files I'm using are:

# redis-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis-tmo
  labels:
    app: redis
spec:
  selector:
    matchLabels:
      app: redis
      role: master
      tier: backend
  replicas: 1
  template: 
    metadata:
      labels:
        app: redis
        role: master
        tier: backend
    spec:
      containers:
      - name: master
        image: redislabs/redismod:latest
        command:
        - redis-server
        - "/redis-tmo/redis.conf"
        env:
        - name: MASTER
          value: "true"
        volumeMounts:
        - mountPath: /redis-tmo
          name: config
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 6379
      volumes:
        - name: config
          configMap:
            name: redis-tmo-config
            items:
            - key: redis-config
              path: redis.conf

# redis-loadbalancer.yaml
apiVersion: v1
kind: Service
metadata:
  name: redis-tmo
  labels:
    app: redis
    role: master
    tier: backend
spec:
  type: LoadBalancer
  ports:
  - port: 6379
    targetPort: 6379
  selector:
    app: redis
    role: master
    tier: backend

# redis-configmap.yaml
apiVersion: v1
data:
  redis-config: |-
    maxmemory 2mb
    maxmemory-policy allkeys-lru
kind: ConfigMap
metadata:
  name: redis-tmo-config
  namespace: default

And to run the server on the K8s cluster, I used:

minikube start 
kubectl apply -f [PATH TO FILES] 
minikube dashboard (monitoring the cluster with a GUI) 
minikube tunnel (creates a network route to allow the host to connect to external traffic via a Cluster IP gateway)

Is there anything I missed when writting these files?

PS.:
Running with docker compose up

image

Running with k8s cluster

image

As can be seen on the images, with docker compose the modules are loaded as expected, but not with k8s.

Att,

Felipe Vallim.

@Twinki14
Copy link

Twinki14 commented Jul 9, 2023

Also currently investigating this same exact issue, they load fine locally on a Windows based host in docker, but in a pod on a k3s node, it's not loading any modules

@Twinki14
Copy link

Twinki14 commented Jul 9, 2023

It appears the modules aren't loading by default, but adding --loadmodule to the args it'll load whichever modules just fine

      containers:
      - name: redis
        image: redislabs/redismod:latest
        args:
        - --appendonly
        - 'yes'
        - --maxmemory
        - 256Mb
        - --loadmodule
        - /usr/lib/redis/modules/rejson.so
        - --loadmodule
        - /usr/lib/redis/modules/redisearch.so

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

1 participant