{
  "id": "openshift-cli",
  "title": "Deployment with OpenShift CLI for Redis Enterprise for Kubernetes",
  "url": "https://redis.io/docs/latest/operate/kubernetes/7.8.4/deployment/openshift/openshift-cli/",
  "summary": "Redis Enterprise for Kubernetes and cluster can be installed via CLI tools OpenShift",
  "content": "Use these steps to set up a Redis Enterprise Software cluster with OpenShift.\n\n## Prerequisites\n\n- [OpenShift cluster](https://docs.openshift.com/container-platform/4.8/installing/index.html) with at least 3 nodes (each meeting the [minimum requirements for a development installation]())\n- [OpenShift CLI](https://docs.openshift.com/container-platform/latest/cli_reference/openshift_cli/getting-started-cli.html)\n\nTo see which version of Redis Enterprise for Kubernetes supports your OpenShift version, see [Supported Kubernetes distributions]().\n\n## Deploy the operator\n\n1. Create a new project.\n\n    ```sh\n    oc new-project \u003cyour-project-name\u003e \n    ```\n\n1. Verify the newly created project. \n\n    ```sh\n    oc project \u003cyour-project-name\u003e\n    ```\n\n1. Get the deployment files.\n\n    ```sh\n    git clone https://github.com/RedisLabs/redis-enterprise-k8s-docs\n    ```\n\n1. Deploy the OpenShift operator bundle.\n\n    If you are using version 6.2.18-41 or earlier, you must [apply the security context constraint](#install-security-context-constraint) before the operator bundle.\n\n    ```sh\n    oc apply -f openshift.bundle.yaml\n    ```\n\n    \nChanges to the `openshift.bundle.yaml` file can cause unexpected results.\n    \n\n1. Verify that your `redis-enterprise-operator` deployment is running.\n\n    ```sh\n    oc get deployment\n    ```\n\n    A typical response looks like this:\n\n    ```sh\n    NAME                        READY   UP-TO-DATE   AVAILABLE   AGE\n    redis-enterprise-operator   1/1     1            1           0m36s\n    ```\n\n    \nDO NOT modify or delete the StatefulSet created during the deployment process. Doing so could destroy your Redis Enterprise cluster (REC).\n    \n\n## Install security context constraint\n\nThe Redis Enterprise pods must run in OpenShift with privileges set in a [Security Context Constraint](https://docs.openshift.com/container-platform/4.4/authentication/managing-security-context-constraints.html#security-context-constraints-about_configuring-internal-oauth). This grants the pod various rights, such as the ability to change system limits or run as a particular user.\n\n1. Apply the file `scc.yaml` file.\n\n   \nDo not edit this file.\n    \n\n    ```sh\n    oc apply -f openshift/scc.yaml\n    ```\n\n    You should receive the following response:\n\n    ```sh\n    securitycontextconstraints.security.openshift.io \"redis-enterprise-scc-v2\" configured\n    ```\n\n    Releases before 6.4.2-6 use the earlier version of the SCC, named `redis-enterprise-scc`.\n\n1. Provide the operator permissions for the pods.\n\n    ```sh\n    oc adm policy add-scc-to-user redis-enterprise-scc-v2 \\\n      system:serviceaccount:\u003cmy-project\u003e:\u003crec\u003e\n    ```\n\n    \nIf you are using version 6.2.18-41 or earlier, add additional permissions for your cluster.\n\n```sh\noc adm policy add-scc-to-user redis-enterprise-scc \\\nsystem:serviceaccount:\u003cmy-project\u003e:redis-enterprise-operator\n```\n\n\n  You can check the name of your project using the `oc project` command. To replace the project name, use `oc edit project myproject`. Replace `rec` with the name of your Redis Enterprise cluster, if different.\n\n## Create a Redis Enterprise cluster custom resource\n\n1. Apply the `RedisEnterpriseCluster` resource file ([rec_rhel.yaml](https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/openshift/rec_rhel.yaml)).\n\n    You can rename the file to `\u003cyour_cluster_name\u003e.yaml`, but it is not required. Examples below use `\u003crec_rhel\u003e.yaml`. [Options for Redis Enterprise clusters]() has more info about the Redis Enterprise cluster (REC) custom resource, or see the [Redis Enterprise cluster API]() for a full list of options.\n\n    The REC name cannot be changed after cluster creation.\n\n    \nEach Redis Enterprise cluster requires at least 3 nodes. Single-node RECs are not supported.\n    \n\n2. Apply the custom resource file to create your Redis Enterprise cluster.\n\n    ```sh\n    oc apply -f \u003crec_rhel\u003e.yaml\n    ```\n\n    The operator typically creates the REC within a few minutes.\n\n1. Check the cluster status.\n\n    ```sh\n    oc get pod\n    ```\n\n    You should receive a response similar to the following:\n\n    ```sh\n     NAME                             | READY | STATUS  | RESTARTS | AGE |\n    | -------------------------------- | ----- | ------- | -------- | --- |\n    | rec-name-0              | 2/2   | Running | 0        | 1m  |\n    | rec-name-1              | 2/2   | Running | 0        | 1m  |\n    | rec-name-2              | 2/2   | Running | 0        | 1m  |\n    | rec-name-controller-x-x | 1/1   | Running | 0        | 1m  |\n    | Redis-enterprise-operator-x-x    | 1/1   | Running | 0        | 5m  |\n    ```\n\n## Configure the admission controller\n\n\n\n### Limit the webhook to relevant namespaces\n\nIf not limited, the webhook intercepts requests from all namespaces. If you have several REC objects in your Kubernetes cluster, limit the webhook to the relevant namespaces. If you aren't using multiple namespaces, skip this step.\n\n1. Verify your namespace is labeled and the label is unique to this namespace, as shown in the next example.\n\n    ```sh\n    apiVersion: v1\n    kind: Namespace\n    metadata:\n      labels:\n       namespace-name: staging\n    name: staging\n    ```\n\n1. Patch the webhook spec with the `namespaceSelector` field.\n\n    ```sh\n    cat \u003e modified-webhook.yaml \u003c\u003cEOF\n    webhooks:\n    - name: redisenterprise.admission.redislabs\n      namespaceSelector:\n       matchLabels:\n         namespace-name: staging\n    EOF\n    ```\n\n1. Apply the patch.\n\n    ```sh\n    oc patch ValidatingWebhookConfiguration \\\n      redis-enterprise-admission --patch \"$(cat modified-webhook.yaml)\"\n    ```\n\n    \nFor releases before 6.4.2-4, use this command instead:\n\n```sh\noc patch ValidatingWebhookConfiguration \\\n  redb-admission --patch \"$(cat modified-webhook.yaml)\"\n```\n\nThe 6.4.2-4 release introduces a new `ValidatingWebhookConfiguration` to replace `redb-admission`. See the [6.4.2-4 release notes]().\n    \n\n### Verify admission controller installation\n\nApply an invalid resource as shown below to force the admission controller to reject it. If it applies successfully, the admission controller is not installed correctly.\n\n```sh\noc apply -f - \u003c\u003c EOF\napiVersion: app.redislabs.com/v1alpha1\nkind: RedisEnterpriseDatabase\nmetadata:\n  name: redis-enterprise-database\nspec:\n  evictionPolicy: illegal\nEOF\n```\n\nYou should see this error from the admission controller webhook `redisenterprise.admission.redislabs`.\n  \n```sh\nError 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']\n```\n\n## Create a Redis Enterprise database custom resource\n\nThe operator uses the instructions in the Redis Enterprise database (REDB) custom resources to manage databases on the Redis Enterprise cluster.\n\n1. Create a `RedisEnterpriseDatabase` custom resource.\n\n    This example creates a test database. For production databases, see [create a database]() and [RedisEnterpriseDatabase API reference]().\n\n    ```sh\n    cat \u003c\u003c EOF \u003e /tmp/redis-enterprise-database.yml\n    apiVersion: app.redislabs.com/v1alpha1\n    kind: RedisEnterpriseDatabase\n    metadata:\n      name: redis-enterprise-database\n    spec:\n      memorySize: 100MB\n    EOF\n    ```\n\n1. Apply the newly created REDB resource.\n\n    ```sh\n    oc apply -f /tmp/redis-enterprise-database.yml\n    ```\n\n## More info\n\n- [Redis Enterprise cluster API]()\n- [Redis Enterprise database API]()\n",
  "tags": ["docs","operate","kubernetes"],
  "last_updated": "2026-04-08T12:21:52-07:00"
}

