Create Instance

Following Redis versions are fully supported: 6.0 and 7.2; other versions are not supported by default.

Version suggestion

When used in a production environment, it is recommended to prioritize the 7.2 version over 6.0. 7.2 is the default version.

  1. 7.2 is still maintained by the community and fixes known issues in 6.0. The 6.0 version is no longer maintained by the community.
  2. 7.2 is fully compatible with 6.0.
  3. 7.2 has further improved the ACL features.
  4. Cross-datacenter replication features introduced in v5.1.0 — including Active-Active mode — are available on 7.2 only.
Architecture suggestion

Single-node architecture has no replica nodes and lacks failover capabilities, so it should only be used in development and testing environments. You can choose between Sentinel architecture and Cluster architecture based on your business's data and concurrency needs.

Create Redis Instance

Procedure

Sentinel CLI
Cluster CLI
Standalone CLI
Web Console

Create a Redis 6.0 Sentinel mode instance using CLI:

$ cat << EOF | kubectl -n default create -f -
apiVersion: middleware.alauda.io/v1
kind: Redis
metadata:
  name: s6
spec:
  arch: sentinel
  customConfig:
    databases: "16"
    hz: "10"
    save: 60 10000 300 100 600 1
    timeout: "0"
  exporter:
    enabled: true
    resources:
      limits:
        cpu: 100m
        memory: 384Mi
      requests:
        cpu: 50m
        memory: 128Mi
  replicas:
    sentinel:
      master: 1
      slave: 1
  resources:
    limits:
      cpu: "1"
      memory: 2Gi
    requests:
      cpu: "1"
      memory: 2Gi
  sentinel:
    monitorConfig:
      down-after-milliseconds: "30000"
      failover-timeout: "180000"
      parallel-syncs: "1"
    replicas: 3
    resources:
      limits:
        cpu: 100m
        memory: 128Mi
      requests:
        cpu: 100m
        memory: 128Mi
  version: "6.0"
EOF

Refer to the Redis API documentation for field descriptions.

Sentinel password

A Sentinel instance has two independent default user passwords: spec.passwordSecret authenticates the Redis data nodes, and spec.sentinel.passwordSecret authenticates the Sentinel nodes. The example above sets neither, which leaves both open. The Web Console enables the Sentinel password by default; when creating an instance from the CLI, set it explicitly.

Each field references a Secret in the same namespace that holds the password under the password key, and the password must be 8 to 32 characters long.

$ kubectl -n default create secret generic s6-sentinel-password --from-literal=password='<sentinel-password>'

Then reference it from the instance:

spec:
  sentinel:
    passwordSecret: s6-sentinel-password

Clients connecting through Sentinel must supply this password separately from the Redis password — refer to Accessing Instances (Sentinel Mode).

After the instance is created, you can use the following command to check the status of the instance:

$ kubectl -n default get redis
NAME         ARCH         VERSION   ACCESS     STATUS         MESSAGE   BUNDLE VERSION   AUTOUPGRADE   AGE
c6           cluster      6.0                  Initializing             5.1.0                         3m26s
c7           cluster      7.2       NodePort   Initializing             5.1.0                         98s
s6           sentinel     6.0                  Ready                    5.1.0                         25m
s7           sentinel     7.2       NodePort   Ready                    5.1.0                         2m15s
standalone   standalone   6.0                  Initializing             5.1.0                         6s

The meanings of the output table fields are as follows:

FieldDescription
NAMEInstance name
ARCHThis value corresponds to the architecture of Redis.
  • cluster: Cluster mode
  • sentinel: Sentinel mode
  • standalone: Single-node Redis
This field indicates whether this CR resource manages a standalone, Sentinel, or Cluster mode of Redis.
VERSIONCurrently supports the 2 versions: 6.0 and 7.2
ACCESSThe access methods supported by the instance.
  • : The instance provides services via ClusterIP
  • NodePort: The instance provides services via NodePort
  • LoadBalancer: The instance provides services via LoadBalancer
STATUSThe current status of the instance, which may include the following states:
  • Initializing: The instance is initializing or updating
  • Rebalancing: The cluster instance is scaling up or down
  • Error: The instance has encountered a non-recoverable error
  • Paused: The instance has been manually paused
  • Ready: The instance is ready
MESSAGEThe reason for the instance being in its current status
BUNDLE VERSIONThe version number of the operator managing the instance
AUTOUPGRADEWhether automatic upgrades are enabled for the instance
AGEHow long ago the instance was created