Redis Sentinel Gateway is a lightweight Go application designed to monitor Redis Sentinel for master node changes and automatically update Kubernetes Endpoints based on these changes. It simplifies the failover process by serving as a single point of entry for Redis, allowing clients to avoid dealing with Sentinel logic directly.
The application is fully configurable via environment variables:
| Environment Variable | Description | Default Value |
|---|---|---|
SERVICE_NAME |
Name of the Kubernetes service | redis-failover |
SENTINEL_ADDR |
Address of the Redis Sentinel | rfs-redis-node:26379 |
MASTER_NAME |
Name of the Redis master in Sentinel | mymaster |
NAMESPACE |
Kubernetes namespace (auto-detected if not set) | Auto-detected |
POLL_INTERVAL |
Interval between Kubernetes Endpoint updates | 10s |
TICK_INTERVAL |
Interval for checking master node changes | 1s |
LEASE_NAME |
Name of the Kubernetes lease for leader election | redis-failover-lease |
PORT_NAME |
Name of the port for the service | redis |
PORT_NUMBER |
Port number for the service | 6379 |
REDIS_PASSWORD |
Password for connecting to Redis Sentinel | None |
REDIS_PASSWORD_SECRET_NAME |
Secret name for Redis password | redis-sentinel-server |
REDIS_PASSWORD_KEY |
Key in the secret for Redis password | redis-password |
HOSTNAME |
Pod’s hostname, used as a unique identifier | Auto-detected |
Redis Sentinel Gateway provides a unique solution for managing Redis failover scenarios. Unlike other approaches that rely on complex integrations or higher latency options, this project is built with low-latency performance in mind. The gateway continuously monitors Redis Sentinel and instantly updates the Kubernetes Endpoints to reflect the current master node, ensuring minimal delay during failover events.
This project is especially useful for legacy applications or older services where adding Sentinel support may not be possible. Many legacy systems either don’t have Sentinel support, or they rely on deprecated libraries that are difficult to maintain. With Redis Sentinel Gateway, there is no need to modify the application’s codebase to introduce Sentinel support, ensuring high availability without costly refactoring.
During load tests and high traffic scenarios, other approaches using Sentinel proxies showed significant latency spikes. Redis Sentinel Gateway is optimized to minimize these spikes, making it ideal for high-performance environments.
To install the Redis Sentinel Gateway via Helm, follow these steps:
Add the Helm repository:
helm repo add redis-gateway https://promzeus.github.io/redis-sentinel-gateway
Install the chart:
helm install redis-sentinel-gateway redis-gateway/redis-sentinel-gateway --namespace redis --create-namespace
Upgrade the chart:
If you need to update the application with new changes, simply run:
helm upgrade redis-sentinel-gateway redis-gateway/redis-sentinel-gateway --namespace redis
Customizing the installation:
You can override the default values for the chart by passing your own values.yaml file. For example:
helm install redis-sentinel-gateway redis-gateway/redis-sentinel-gateway --namespace redis --create-namespace -f values.yaml
This project is licensed under the MIT License.