Deploy Redis Enterprise Software for Kubernetes

How to install Redis Enterprise Software for Kubernetes.

To deploy Redis Enterprise Software for Kubernetes and start your Redis Enterprise cluster (REC), you need to do the following:

  • Create a new namespace in your Kubernetes cluster.
  • Download the operator bundle.
  • Apply the operator bundle and verify it's running.
  • Create a Redis Enterprise cluster (REC).

This guide works with most supported Kubernetes distributions. If you're using OpenShift, see Redis Enterprise on OpenShift. For details on what is currently supported, see supported distributions.


To deploy Redis Enterprise for Kubernetes, you'll need:

  • a Kubernetes cluster in a supported distribution
  • a minimum of three worker nodes
  • a Kubernetes client (kubectl)
  • access to DockerHub, RedHat Container Catalog, or a private repository that can hold the required images.

Create a new namespace

Important: Each namespace can only contain one Redis Enterprise cluster. Multiple RECs with different operator versions can coexist on the same Kubernetes cluster, as long as they are in separate namespaces.

Throughout this guide, each command is applied to the namespace in which the Redis Enterprise cluster operates.

  1. Create a new namespace
kubectl create namespace <rec-namespace>
  1. Change the namespace context to make the newly created namespace default for future commands.
kubectl config set-context --current --namespace=<rec-namespace>

You can use an existing namespace as long as it does not contain any existing Redis Enterprise cluster resources. It's best practice to create a new namespace to make sure there are no Redis Enterprise resources that could interfere with the deployment.

Install the operator

Redis Enterprise for Kubernetes bundle is published as a container image. A list of required images is available in the release notes for each version.

The operator definition and reference materials are available on GitHub. The operator definitions are packaged as a single generic YAML file.

If you do not pull images from DockerHub or another public registry, you need to use a private container registry.

Download the operator bundle

Pull the latest version of the operator bundle:

VERSION=`curl --silent | grep tag_name | awk -F'"' '{print $4}'`

If you need a different release, replace VERSION with a specific release tag.

Check version tags listed with the operator releases on GitHub or by using the GitHub API to ensure the version of the bundle is correct.

Deploy the operator bundle

Apply the operator bundle in your REC namespace:

kubectl apply -f$VERSION/bundle.yaml

You should see a result similar to this: created
serviceaccount/redis-enterprise-operator created created configured configured
deployment.apps/redis-enterprise-operator created
DO NOT modify or delete the StatefulSet created during the deployment process. Doing so could destroy your Redis Enterprise cluster (REC).

Verify the operator is running

Check the operator deployment to verify it's running in your namespace:

kubectl get deployment redis-enterprise-operator

You should see a result similar to this:

NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
redis-enterprise-operator   1/1     1            1           0m36s

Create a Redis Enterprise cluster (REC)

A Redis Enterprise cluster (REC) is created from a RedisEnterpriseCluster custom resource that contains cluster specifications.

The following example creates a minimal Redis Enterprise cluster. See the RedisEnterpriseCluster API reference for more information on the various options available.

  1. Create a file that defines a Redis Enterprise cluster with three nodes.

    The REC name (my-rec in this example) cannot be changed after cluster creation.

    cat <<EOF > my-rec.yaml
    apiVersion: ""
    kind: "RedisEnterpriseCluster"
      name: my-rec
      nodes: 3

    This will request a cluster with three Redis Enterprise nodes using the default requests (i.e., 2 CPUs and 4GB of memory per node).

    To test with a larger configuration, use the example below to add node resources to the spec section of your test cluster (my-rec.yaml).

        cpu: 2000m
        memory: 16Gi
        cpu: 2000m
        memory: 16Gi
    Each cluster must have at least 3 nodes. Single-node RECs are not supported.

    See the Redis Enterprise hardware requirements for more information on sizing Redis Enterprise node resource requests.

  2. Apply your custom resource file in the same namespace as my-rec.yaml.

kubectl apply -f my-rec.yaml

You should see a result similar to this: created
  1. You can verify the creation of the cluster with:
kubectl get rec

You should see a result similar to this:

NAME           AGE
my-rec   1m

At this point, the operator will go through the process of creating various services and pod deployments.

You can track the progress by examining the StatefulSet associated with the cluster:

kubectl rollout status sts/my-rec

or by looking at the status of all of the resources in your namespace:

kubectl get all

Enable the admission controller

The admission controller dynamically validates REDB resources configured by the operator. It is strongly recommended that you use the admission controller on your Redis Enterprise Cluster (REC). The admission controller only needs to be configured once per operator deployment.

As part of the REC creation process, the operator stores the admission controller certificate in a Kubernetes secret called admission-tls. You may have to wait a few minutes after creating your REC to see the secret has been created.

  1. Verify the admission-tls secret exists.

     kubectl get secret admission-tls

    The output should look similar to

     NAME            TYPE     DATA   AGE
     admission-tls   Opaque   2      2m43s
  2. Save the certificate to a local environment variable.

    CERT=`kubectl get secret admission-tls -o jsonpath='{.data.cert}'`
  3. Create a Kubernetes validating webhook, replacing <namespace> with the namespace where the REC was installed.

    The webhook.yaml template can be found in redis-enterprise-k8s-docs/admission

    sed 's/OPERATOR_NAMESPACE/<namespace>/g' webhook.yaml | kubectl create -f -
  4. Create a patch file for the Kubernetes validating webhook.

    cat > modified-webhook.yaml <<EOF
    - name: redisenterprise.admission.redislabs
        caBundle: $CERT
      admissionReviewVersions: ["v1beta1"]
  5. Patch the webhook with the certificate.

    kubectl patch ValidatingWebhookConfiguration \
      redis-enterprise-admission --patch "$(cat modified-webhook.yaml)"

Limit the webhook to the relevant namespaces

The operator bundle includes a webhook file. The webhook will intercept requests from all namespaces unless you edit it to target a specific namespace. You can do this by adding the namespaceSelector section to the webhook spec to target a label on the namespace.

  1. Make sure the namespace has a unique namespace-name label.

    apiVersion: v1
    kind: Namespace
        namespace-name: example-ns
    name: example-ns
  2. Patch the webhook to add the namespaceSelector section.

    cat > modified-webhook.yaml <<EOF
    - name: redisenterprise.admission.redislabs
          namespace-name: staging
  3. Apply the patch.

    kubectl patch ValidatingWebhookConfiguration \
      redis-enterprise-admission --patch "$(cat modified-webhook.yaml)"

Verify the admission controller is working

  1. Verify the admission controller is installed correctly by applying an invalid resource. This should force the admission controller to correct it.

    kubectl apply -f - << EOF
    kind: RedisEnterpriseDatabase
      name: redis-enterprise-database
      evictionPolicy: illegal

You should see your request was denied by the admission webhook "redisenterprise.admission.redislabs".

Error from server: error when creating "STDIN": admission webhook "redisenterprise.admission.redislabs" denied the request: eviction_policy: u'illegal' is not one of [u'volatile-lru', u'volatile-ttl', u'volatile-random', u'allkeys-lru', u'allkeys-random', u'noeviction', u'volatile-lfu', u'allkeys-lfu']

Create a Redis Enterprise Database (REDB)

You can create multiple databases within the same namespace as your REC or in other namespaces.

See manage Redis Enterprise databases for Kubernetes to create a new REDB.

Back to top ↑