Installing Redis on Kubernetes for Tracardi

Installing Redis on Kubernetes for Tracardi
Photo by Patrick Lindenberg / Unsplash

Redis, an in-memory data structure store, is a crucial component for many modern applications, including Tracardi, an open-source customer data platform. This guide will walk you through the process of installing Redis on a Kubernetes (K8s) cluster, ensuring you have a robust, scalable, and highly available Redis setup to support your Tracardi deployment.

Prerequisites

Before we begin, make sure you have the following:

  1. A functioning Kubernetes cluster
  2. kubectl command-line tool installed and configured to communicate with your cluster
  3. Helm package manager installed on your local machine

These prerequisites will ensure a smooth installation process and enable you to manage your Redis deployment effectively.

Step 1: Adding the Helm Repository

We'll be using Helm, a package manager for Kubernetes, to simplify the Redis installation process. The first step is to add the Bitnami repository, which contains a pre-configured Helm chart for Redis.

Open your terminal and run the following command:

helm repo add bitnami https://charts.bitnami.com/bitnami

This command registers the Bitnami repository with Helm, making the Redis chart available for installation.

Step 2: Updating the Helm Repository

To ensure you have access to the latest charts and updates, it's important to update your Helm chart repository:

helm repo update

This command synchronizes your local Helm chart repository with the remote one, ensuring you have the most up-to-date version of the Redis chart.

Step 3: Configuring Your Redis Deployment

Now, we need to create a configuration file that defines the structure and resources for our Redis deployment. Create a new file named values.yaml and add the following content:

master:
  persistence:
    size: 2Gi
  resources:
    limits:
      memory: 2Gi
    requests:
      memory: 1Gi
replica:
  persistence:
    size: 5Gi
  replicaCount: 1
  resources:
    limits:
      memory: 2Gi
    requests:
      memory: 1Gi

This configuration sets up a Redis deployment with one master node and one replica node. Here's a breakdown of the settings:

  • Master node:
    • 2GB of persistent storage
    • Memory limit of 2GB, with a request of 1GB
  • Replica node:
    • 5GB of persistent storage
    • Memory limit of 2GB, with a request of 1GB
    • One replica instance

Feel free to adjust these values based on your specific requirements and available resources.

Step 4: Creating a Dedicated Namespace

It's a good practice to isolate different components of your application stack. Let's create a dedicated namespace for our Redis deployment:

kubectl create namespace redis

This command creates a new namespace called "redis" where we'll deploy our Redis instances.

Step 5: Installing Redis

Now comes the exciting part – actually installing Redis! Run the following command:

helm upgrade --install redis bitnami/redis --values values.yaml --namespace redis --create-namespace

Let's break down this command:

  • helm upgrade --install: This tells Helm to install Redis if it doesn't exist, or upgrade it if it does.
  • redis: This is the name we're giving to our Redis release.
  • bitnami/redis: This specifies the chart we're using from the Bitnami repository.
  • --values values.yaml: This applies our custom configuration from the values.yaml file we created earlier.
  • --namespace redis: This deploys Redis in the "redis" namespace we created.
  • --create-namespace: This ensures the namespace is created if it doesn't already exist.

Step 6: Verifying the Installation

After a few minutes, your Redis deployment should be up and running. To verify the installation, use this command:

kubectl get pods -n redis

You should see output similar to this:

NAME                READY   STATUS    RESTARTS   AGE
redis-master-0      1/1     Running   0          5m
redis-replica-0     1/1     Running   0          5m

If all pods are in the "Running" state, congratulations! Your Redis deployment is now operational and ready for use with Tracardi.

Conclusion

You've successfully installed a Redis deployment on Kubernetes, tailored for use with Tracardi. This setup provides a robust, scalable in-memory data store that will serve as a solid foundation for your Tracardi deployment.

Remember, you can always modify your Redis deployment in the future by updating the values.yaml file and running the Helm upgrade command again. This flexibility allows you to adapt your Redis setup as your needs change over time.

With your Redis deployment now in place, you're one step closer to leveraging the full power of Tracardi for your customer data management needs. Happy data processing!