Quick revision
The short answer
Sentinel remembers and announces IP addresses, and on Kubernetes pod IPs change whenever a pod is rescheduled, so Sentinels keep stale entries and can hand clients an address that now belongs to another pod. We fix it with stable DNS names (resolve-hostnames and announce-hostnames, Redis 6.2 and later), SENTINEL RESET after topology changes, PodDisruptionBudgets, anti-affinity and a pre-stop hook that fails over before the primary stops, and at 40 deployments we prefer a maintained operator or a managed service, with regular drain drills.
What to remember
In this answer, we saw that Sentinel keeps and announces IP addresses and never forgets members, so rescheduled pods leave stale entries and reused IPs can send clients to the wrong pod. We switched to stable headless-service names with resolve-hostnames and announce-hostnames, cleaned up with SENTINEL RESET one Sentinel at a time, made drains safe with PDBs, anti-affinity and a pre-stop failover hook, and preferred an operator or managed service for 40 deployments, verified by regular drills.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Sentinel remembers and announces IP addresses, and on Kubernetes pod IPs change whenever a pod is rescheduled, so Sentinels keep stale entries and can hand clients an address that now belongs to another pod. We fix it with stable DNS names (resolve-hostnames and announce-hostnames, Redis 6.2 and later), SENTINEL RESET after topology changes, PodDisruptionBudgets, anti-affinity and a pre-stop hook that fails over before the primary stops, and at 40 deployments we prefer a maintained operator or a managed service, with regular drain drills.
Why this question is asked
Sentinel was designed for machines with fixed addresses, and Kubernetes treats addresses as disposable. The mismatch stays hidden until a node drain moves several pods at once, and then Sentinels describe a topology that no longer exists while clients connect to the wrong pod. Interviewers ask this scenario because it tests whether we understand what state Sentinel keeps, and whether we can turn a fragile setup into routine operations across many deployments. In this answer, we will recap what Sentinel stores, see how a drain breaks it, switch to stable names, clean up stale state, make drains safe, and decide how to run 40 of these.
1A Quick Recap: What Sentinel Remembers
Each Sentinel keeps its view of the world in memory and in its own configuration file: the primary's address, every replica it has discovered, and every other Sentinel it has heard from on the shared hello channel. It rewrites sentinel.conf as it learns. Entries are never forgotten automatically; a replica or Sentinel that disappears is kept as down, on the assumption that it may come back at the same address.
Clients rely on that view. They ask SENTINEL get-master-addr-by-name and connect to whatever address comes back.
2How a Node Drain Breaks It
In a StatefulSet, pod redis-1 keeps its name and its volume when rescheduled, but it gets a new pod IP. After the drain, Sentinels still list the old IP of redis-1 as a replica that is down, and they discover the same pod again at its new IP as a new replica. Sentinel pods that moved appear twice as well. The counts of known replicas and Sentinels grow, and quorum and majority calculations include members that will never answer.
Worse, Kubernetes reuses IPs. If the primary was announced by IP and the pod moved, the old IP may now belong to a pod of another service, and a client that was told that address connects to something that is not our Redis at all, or to a different Redis. That is exactly what the team saw.
| Entry | Address | Reality |
|---|---|---|
| replica redis-1 | 10.4.2.17 | old IP, pod moved, marked down forever |
| replica redis-1 | 10.4.7.33 | same pod at its new IP, counted again |
| sentinel-2 | 10.4.2.18 | old IP, now used by another service's pod |
| primary redis-0 | 10.4.1.9 | still correct, until redis-0 moves |
3Use Stable Names Instead of IPs
Since Redis 6.2, Sentinel can work with hostnames. With resolve-hostnames yes it accepts names in its configuration and resolves them, and with announce-hostnames yes it hands names, not IPs, to clients and other Sentinels. The Redis nodes announce a hostname as well, through replica-announce-ip set to the name. On Kubernetes, the StatefulSet's headless service gives every pod a stable DNS name that follows the pod wherever it runs.
Check two things before switching. The client must accept a hostname from Sentinel; recent Lettuce versions do, but test it. And DNS for headless services must update quickly when a pod moves, so check the TTL your cluster DNS uses.
4Cleaning Up Stale Entries
Names stop new stale entries from appearing, but existing ones must be removed. SENTINEL RESET orders makes a Sentinel forget its known replicas and Sentinels for that primary and rediscover them within a few seconds. Run it on one Sentinel at a time, waiting until it has rediscovered the others before moving to the next, so the group never loses its majority.
Then make drift visible: export the number of known replicas and Sentinels from SENTINEL REPLICAS and SENTINEL SENTINELS for every deployment, and alert when they differ from the expected counts, for example two replicas and two other Sentinels.
5Making Drains Routine
A PodDisruptionBudget with maxUnavailable 1 for the Redis pods and another for the Sentinel pods ensures a drain never takes two members down at once. Pod anti-affinity spreads them across nodes, and topology spread constraints across zones, so one node or zone never holds a majority.
The primary needs special care. A pre-stop hook checks whether the pod being stopped is the primary, and if so runs SENTINEL FAILOVER orders and waits until another pod reports itself as primary. That turns a crash-style failover, with detection time and errors, into a planned switch of a second or two.
- Kubernetes sends pre-stopnode drain or rollout
- Is this pod the primary?YesAsk a Sentinel to fail overNoStop normally
- SENTINEL FAILOVER ordersplanned switch
- New primary reported within 30 s?YesStop the podNoStop anyway and alert
4 steps in order. Play them, or step through them one at a time.
6Running 40 of Them
Doing all of this by hand for 40 deployments means 40 copies of scripts and configuration that drift apart. A maintained operator encodes failover, hostname announcement, PDBs and cleanup in one place, and a managed Redis service removes the problem entirely at a price. Whichever we choose, we run drain drills regularly, for example draining one node per week in staging and one per month in production, and check that clients saw only a brief blip.
7Follow-up questions
What would you check before trusting an operator with this?
How it fails over (its own logic or Sentinel), whether it announces stable names, how it handles a drain of the primary's node, how it upgrades Redis and itself, whether it is actively maintained and supports our Redis version, how it does backups, and its licence. Then we run our own drills against it: drain, kill the primary, partition a zone, and roll an upgrade under load.
Why not just use a Kubernetes Service in front of the primary?
A Service with a selector on a role label can point clients at the current primary, if something updates the label on failover. That works, but the label update is another moving part, and Sentinel-aware clients still need correct Sentinel data. Many operators combine both.
Would Redis Cluster avoid these problems?
Cluster nodes also announce addresses, and Redis 7 added cluster-announce-hostname for the same reason. Moving to Cluster changes the failure model but not the need for stable names.
8Conclusion
In this answer, we saw that Sentinel keeps and announces IP addresses and never forgets members, so rescheduled pods leave stale entries and reused IPs can send clients to the wrong pod. We switched to stable headless-service names with resolve-hostnames and announce-hostnames, cleaned up with SENTINEL RESET one Sentinel at a time, made drains safe with PDBs, anti-affinity and a pre-stop failover hook, and preferred an operator or managed service for 40 deployments, verified by regular drills.
Open with
The fragility comes from addresses. Sentinel stores the IPs of the primary, the replicas and the other Sentinels, never forgets them, and hands those IPs to clients. On Kubernetes a rescheduled pod keeps its name but gets a new IP, so after a drain Sentinels list old replicas that will never return next to the same pods at new addresses, and because IPs are reused, a client can be given an address that now belongs to another service's pod.
Then, if they want more
My first change is stable names: since Redis 6.2 Sentinel supports resolve-hostnames and announce-hostnames, so I use the StatefulSet's headless-service DNS names for Sentinel and have the Redis nodes announce their names, after checking that our client accepts hostnames.
Then I clean up the existing state with SENTINEL RESET, one Sentinel at a time, and alert when the number of known replicas or Sentinels differs from what we expect.
To make drains routine I add PodDisruptionBudgets so only one Redis or Sentinel pod is down at a time, anti-affinity across nodes and zones, and a pre-stop hook that runs SENTINEL FAILOVER when the pod stopping is the primary, so we get a planned switch instead of a crash.
For 40 deployments I would not maintain hand-built StatefulSets; I would use a maintained operator or a managed service, and run drain drills regularly.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Redis 6, Redis 7
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Redis documentation
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What makes Sentinel fragile on Kubernetes, and how would you run it so node drains and...": https://scrivio-interview-library.netlify.app/databases/redis-scaling/8cb3dbb0ef/