redismod
redismod copied to clipboard
Redis on K8s, modules are not loading.
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
Running with k8s cluster
As can be seen on the images, with docker compose the modules are loaded as expected, but not with k8s.
Att,
Felipe Vallim.
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
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