# Redis (ElastiCache Valkey)

Provision an ElastiCache Valkey cluster and connect it to Kloudfuse.
Kloudfuse recommends [Valkey](https://valkey.io/) on ElastiCache. Valkey is a Redis-compatible, open-source in-memory data store maintained by the Linux Foundation. It is a drop-in replacement for Redis, up to 20% cheaper on ElastiCache, and available in AWS GovCloud.

## Prerequisites

- Valkey 8.x
- Instance class: `cache.m5.large` or larger
- Non-clustered mode
- In-transit encryption + auth token enabled
- Same VPC as the EKS cluster

Set the required environment variable before running the commands on this page:

```console
export NAMESPACE=<your-namespace>
export REDIS_PASSWORD=<your-password>
```

Copied!

|     |     |
| --- | --- |
|  | The variable is named `REDIS_PASSWORD` because the Helm chart expects Redis-named keys, even when using Valkey. |

## Create Kubernetes Secret

|     |     |
| --- | --- |
|  | The secret name (`kfuse-redis-credentials`) and key (`redis-password`) are intentionally Redis-named. The Kloudfuse Helm chart expects this exact secret and key, even when using Valkey. |

```console
kubectl create secret generic kfuse-redis-credentials \
  --namespace="$NAMESPACE" \
  --from-literal=redis-password="$REDIS_PASSWORD"
```

Copied!

## Create ElastiCache Cluster

```console
aws elasticache create-replication-group \
  --replication-group-id "<cluster-name>-valkey" \
  --replication-group-description "Kloudfuse Valkey" \
  --engine valkey \
  --engine-version "8.0" \
  --cache-node-type cache.m5.large \
  --num-cache-clusters 1 \
  --transit-encryption-enabled \
  --auth-token "$REDIS_PASSWORD" \
  --at-rest-encryption-enabled
```

Copied!

|     |     |
| --- | --- |
|  | ElastiCache default `maxclients` is **65000**, which is sufficient for most deployments (Kloudfuse bundled Redis uses 20001). For larger clusters, increase it via an ElastiCache parameter group: `aws elasticache create-cache-parameter-group` with `ParameterName=maxclients`. |

## Helm Values

Add the following to your `custom-values.yaml`. Use the ElastiCache primary endpoint from the cluster created above.

- Standard (kfuse)
- FED (kfuse-fed)

```yaml
global:
  cloudProvider: "aws"

redis:
    external:
      host: "<elasticache-endpoint>"
```

```yaml
global:
  cloudProvider: "aws"

redis:
    external:
      host: "<elasticache-endpoint>"
```
