Basic deployment examples

YAML examples for basic Redis Enterprise deployment including RBAC, cluster, and database configurations.

Redis Enterprise for Kubernetes

This page provides complete YAML examples for a basic Redis Enterprise deployment on Kubernetes. These examples include all the essential components you need to deploy a Redis Enterprise cluster and create a database.

For complete deployment instructions, see Deploy on Kubernetes.

Service account

The service account provides an identity for the Redis Enterprise operator.

apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app: redis-enterprise
  name: redis-enterprise-operator

Service account configuration:

  • name: The service account name used by the operator
  • labels: Standard labels for Redis Enterprise resources

Role

The Role defines the permissions needed by the Redis Enterprise operator within the namespace.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  labels:
    app: redis-enterprise
  name: redis-enterprise-operator
rules:
  - apiGroups:
      - rbac.authorization.k8s.io
      - ""
    resources:
      - roles
      - serviceaccounts
      - rolebindings
    verbs:
      - create
      - get
      - update
      - patch
      - delete
  - apiGroups:
      - app.redislabs.com
    resources:
      - "*"
    verbs:
      - delete
      - get
      - list
      - patch
      - create
      - update
      - watch
  - apiGroups:
      - ""
    resources:
      - secrets
    verbs:
      - update
      - get
      - create
      - patch
      - delete
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - endpoints
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - events
    verbs:
      - create
      - patch
  - apiGroups:
      - apps
    resources:
      - deployments
      - statefulsets
      - replicasets
    verbs:
      - create
      - delete
      - get
      - patch
      - update
      - list
      - watch
  - apiGroups:
      - batch
    resources:
      - cronjobs
    verbs:
      - create
      - delete
      - get
      - patch
      - update
      - list
      - watch
  - apiGroups:
      - policy
    resources:
      - poddisruptionbudgets
    verbs:
      - create
      - delete
      - get
      - list
      - watch
      - update
  - apiGroups:
      - ""
    resources:
      - configmaps
    verbs:
      - create
      - delete
      - get
      - update
      - watch
      - list
  - apiGroups:
      - ""
    resources:
      - persistentvolumeclaims
    verbs:
      - create
      - delete
      - get
      - update
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - pods
    verbs:
      - get
      - list
      - update
      - patch
      - delete
      - watch
  - apiGroups:
      - ""
    resources:
      - services
    verbs:
      - get
      - list
      - update
      - patch
      - create
      - delete
      - watch
  - apiGroups:
      - networking.k8s.io
    resources:
      - ingresses
    verbs:
      - create
      - patch
      - delete
      - list
      - update
      - get
      - watch
  - apiGroups:
      - networking.istio.io
    resources:
      - gateways
      - virtualservices
    verbs:
      - get
      - list
      - update
      - patch
      - create
      - delete
      - watch

Role configuration:

  • name: Must match the role name referenced in the role binding
  • rules: Comprehensive permissions for managing Redis Enterprise resources
  • apiGroups: Includes core Kubernetes APIs and Redis Enterprise custom resources

Key permissions:

  • app.redislabs.com: Full access to Redis Enterprise custom resources
  • secrets: Manage TLS certificates and database credentials
  • services: Create and manage service endpoints
  • pods: Monitor and manage Redis Enterprise pods
  • persistentvolumeclaims: Manage persistent storage

Role binding

The RoleBinding connects the service account to the role, granting the necessary permissions.

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    app: redis-enterprise
  name: redis-enterprise-operator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: redis-enterprise-operator
subjects:
  - kind: ServiceAccount
    name: redis-enterprise-operator

Role binding configuration:

  • subjects.name: Must match the service account name
  • roleRef.name: Must match the role name
  • namespace: Apply in the same namespace as other resources

Redis Enterprise cluster

The RedisEnterpriseCluster (REC) custom resource defines the cluster specification.

apiVersion: app.redislabs.com/v1
kind: RedisEnterpriseCluster
metadata:
  name: rec
  labels:
    app: redis-enterprise
spec:
  # The number of Redis Enterprise nodes in the clusters.
  nodes: 3

  persistentSpec:
    # Whether to enable persistent storage for the Redis Enterprise nodes.
    enabled: true

    # The size of the persistent volume for each Redis Enterprise node.
    volumeSize: 20Gi

  # The resources allocated to each Redis Enterprise node.
  redisEnterpriseNodeResources:
    requests:
      cpu: 2
      memory: 4Gi
    limits:
      cpu: 2
      memory: 4Gi

Cluster configuration:

  • metadata.name: Cluster name (cannot be changed after creation)
  • spec.nodes: Number of Redis Enterprise nodes (minimum 3)
  • persistentSpec.volumeSize: Storage size per node
  • redisEnterpriseNodeResources: CPU and memory allocation per node

Edit the values in the downloaded YAML file based on your requirements, such as increasing the number of nodes, adjusting storage size, or modifying resource allocation.

Redis Enterprise database

The RedisEnterpriseDatabase (REDB) custom resource defines the database specification.

apiVersion: app.redislabs.com/v1alpha1
kind: RedisEnterpriseDatabase
metadata:
  name: redb
  labels:
    app: redis-enterprise
spec:
  # Memory size of the database.
  memorySize: 256MB

  # Number of shards in the database.
  shardCount: 1

  # Determines whether replication will be enabled for the database.
  replication: false

Database configuration:

  • metadata.name: Database name
  • spec.memorySize: Memory allocation for the database
  • spec.shardCount: Number of shards (affects performance and scalability)
  • spec.replication: Enable/disable database replication

Edit the values in the downloaded YAML file based on your requirements, such as increasing memory for larger datasets, adding more shards for better performance, enabling replication for high availability, or adding Redis modules.

Apply the configuration

To deploy these YAML files, follow Deploy on Kubernetes, which provides step-by-step instructions for creating namespaces, deploying the operator, and applying these configuration files.

RATE THIS PAGE
Back to top ↑