Skip to content

feat: Add Valkey Sentinel & HAProxy support in High Availability setup.#137

Open
khtee wants to merge 5 commits intovalkey-io:mainfrom
khtee:main
Open

feat: Add Valkey Sentinel & HAProxy support in High Availability setup.#137
khtee wants to merge 5 commits intovalkey-io:mainfrom
khtee:main

Conversation

@khtee
Copy link

@khtee khtee commented Feb 6, 2026

Feat #22

@dmaes
Copy link

dmaes commented Feb 11, 2026

Nice work!

I have some notes/questions:

@khtee
Copy link
Author

khtee commented Feb 11, 2026

Nice work!

I have some notes/questions:

Good points! Will work on both improvements.

@yoannrt
Copy link
Contributor

yoannrt commented Feb 11, 2026

Good job,

I have some questions too,
I assume to discover who is master, you have to ask sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster ?
(Currently, the replica service is sticked to pod-0 in the STS)

Also, would that make sense to run sentinel as a side container in the replica STS pods ?

@amontalban
Copy link
Contributor

Thank you @khtee can't wait to get this merged in 🙏

@dmaes
Copy link

dmaes commented Feb 14, 2026

Also, would that make sense to run sentinel as a side container in the replica STS pods ?

You'll want to disable the default statefulset when sentinel is enabled

I got confused, thinking valkey-sentinel also runs the server process, it's been a while since I used redis/valkey. But yes, @khtee you'll want to run sentinel and the server side-to-side in the same pod, don't split them out in different statefulsets.

@yoannrt
Copy link
Contributor

yoannrt commented Feb 17, 2026

Do you plan on adding a HAProxy deployment, so clients don't have to be aware of sentinel?

@dmaes I guess when you suggest to implement HAproxy, it's for sentinel incompatible clients workloads ?
So this would be optional and the default implementation would be a valkey/sentinel HA setup ?

@khtee khtee marked this pull request as draft February 18, 2026 23:57
@khtee khtee changed the title feat: Add Valkey Sentinel support in High Availability setup. feat: Add Valkey Sentinel & HAProxy support in High Availability setup. Feb 19, 2026
@khtee khtee marked this pull request as ready for review February 19, 2026 01:19
@khtee khtee marked this pull request as draft February 19, 2026 01:30
@khtee khtee marked this pull request as ready for review February 19, 2026 06:11
@khtee
Copy link
Author

khtee commented Feb 19, 2026

Also, would that make sense to run sentinel as a side container in the replica STS pods ?

You'll want to disable the default statefulset when sentinel is enabled

I got confused, thinking valkey-sentinel also runs the server process, it's been a while since I used redis/valkey. But yes, @khtee you'll want to run sentinel and the server side-to-side in the same pod, don't split them out in different statefulsets.

Added following enhancements.

  • Sentinel now runs as a sidecar in valkey pod.
  • HAProxy with sidecar watcher to track failover.

@dmaes
Copy link

dmaes commented Feb 19, 2026

Do you plan on adding a HAProxy deployment, so clients don't have to be aware of sentinel?

@dmaes I guess when you suggest to implement HAproxy, it's for sentinel incompatible clients workloads ? So this would be optional and the default implementation would be a valkey/sentinel HA setup ?

That's correct.

The truly kubernetes-native way would probably be to have a sentinel-master Service, using a sentinel.valkey.io/master: "true" label selector, and then some watcher that updates that label on the correct Pod,
but a HAproxy deployment is the easier option to implement, and is how most other Redis charts do it.

khtee and others added 5 commits February 20, 2026 09:53
Signed-off-by: KHTee <teekahhui@hotmail.com>
Co-authored-by: Dieter Maes <dieter.maes@dmaes.be>
Signed-off-by: khtee <75174583+khtee@users.noreply.github.com>
Signed-off-by: KHTee <teekahhui@hotmail.com>
Allow HAProxy to retry DNS resolution during startup when pending for Valkey node to start.

Essentially it does the following

- Try to use the last known IP.
- If none, query the libc resolver (DNS).
- If that fails, resolve to none (meaning the server has no IP address yet, but HAProxy won't crash) and wait for the runtime resolver health-checks to pick up the DNS correctly.

Signed-off-by: KHTee <teekahhui@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants