This section describes the Redis vector store deployment. Redis is an open source, in-memory data store that can be used as a Vector Store for your embeddings in a RAG scenario.
1. From the OperatorHub, install the Redis Enterprise Operator. You can install the operator with the default value in the namespace that you want to create your Redis cluster (the operator is namespace based).
2. Create new Project in OpenShift cluster:
oc new-project redisdb
3. Create Security Context Constraints using the following yaml manifests:
apiVersion: security.openshift.io/v1 kind: SecurityContextConstraints metadata: name: redis-enterprise-scc-v2 annotations: kubernetes.io/description: redis-enterprise-scc is the minimal SCC needed to run Redis Enterprise nodes on Kubernetes. It provides the same features as restricted-v2 SCC, but allows pods to enable the SYS_RESOURCE capability, which is required by Redis Enterprise nodes to manage file descriptor limits and OOM scores for database shards. Additionally, it requires pods to run as UID/GID 1001, which are the UID/GID used within the Redis Enterprise node containers. allowedCapabilities: - SYS_RESOURCE allowHostDirVolumePlugin: false allowHostIPC : false allowHostNetwork: false allowHostPID: false allowHostPorts: false allowPrivilegeEscalation: false allowPrivilegedContainer: false readOnlyRootFilesystem: false runAsUser: type: MustRunAs uid: 1001 fsGroup: type: MustRunAs ranges: - min: 1001 max: 1001 seLinuxContext: type: MustRunAs seccompProfiles: - runtime/default supplementalGroups: type: RunAsAny
4. Provide the operator permissions for Redis Enterprise Operator and Cluster pods.
oc adm policy add-scc-to-user redis-enterprise-scc system:serviceaccount:redisdb:redis-enterprise-operator oc adm policy add-scc-to-user redis-enterprise-scc system:serviceaccount:redisdb:rec
5. Redis Enterprise Operator deployment is now available using OpenShift dashboard. For a visual walkthrough of Redis Enterprise Operator installation in Openshift cluster, see the Developer Redis page.
6. Once the operator is deployed, create a Redis cluster. You can use the following YAML definition as an example (adapt to your needs regarding size, persistency, storageClass, and more).
apiVersion: app.redislabs.com/v1 kind: RedisEnterpriseCluster metadata: name: rec spec: serviceAccountName: rec redisEnterpriseNodeResources: limits: cpu: '4' ephemeral-storage: 10Gi memory: 4Gi requests: cpu: '4' ephemeral-storage: 1Gi memory: 4Gi bootstrapperImageSpec: repository: registry.connect.redhat.com/redislabs/redis-enterprise-operator clusterCredentialSecretName: rec nodes: 3 persistentSpec: enabled: true storageClassName: gp3-csi volumeSize: 20Gi createServiceAccount: true username: your_admin_username clusterCredentialSecretRole: '' podStartingPolicy: enabled: false startingThresholdSeconds: 540 redisEnterpriseServicesRiggerImageSpec: repository: registry.connect.redhat.com/redislabs/services-manager redisEnterpriseImageSpec: imagePullPolicy: IfNotPresent repository: registry.connect.redhat.com/redislabs/redis-enterprise uiServiceType: ClusterIP clusterCredentialSecretType: kubernetes servicesRiggerSpec: databaseServiceType: 'cluster_ip,headless' serviceNaming: bdb_name services: apiService: type: ClusterIP
7. Once the Redis cluster is ready, you can deploy a database to host the vector store. It is important to enable the search module and set enough memory to hold the initial index capacity. See the following steps for the example.
8. Create the secret for the Redis database using following YAML definition as an example.
apiVersion: v1 kind: Secret metadata: name: redb-my-doc namespace: redisdb type: Opaque stringData: username: default password: 1a2b3c4d
9. Create the Redis database using following YAML definition as an example.
apiVersion: app.redislabs.com/v1alpha1 kind: RedisEnterpriseDatabase metadata: name: my-doc namespace: redisdb spec: databaseSecretName: redb-my-doc memorySize: 4GB modulesList: - name: search version: 2.8.4 persistence: snapshotEvery12Hour replication: true tlsMode: disabled type: redis
10. Once the database is deployed you will have:
11. Your Redis URL is in the different notebooks or applications within this repository, the full URI you can construct will be similar to: redis://default:password@server:port.
With our example, it would be:
redis://default:1a2b3c4d@my-doc-headless.my-namespace.svc.cluster.local:14155.