Redis › Redis with Docker & Kubernetes

How would you deploy a highly available Redis Sentinel setup on Kubernetes to provide automatic failover for a primary and replica configuration?

Advanced

Answer

You would deploy the Redis primary and replicas as a StatefulSet with appropriate persistent volumes, deploy a separate set of Sentinel pods configured to monitor the Redis deployment, expose the Sentinel service so application clients can discover the current primary, and carefully configure appropriate readiness and liveness probes so Kubernetes correctly understands the health status of each component.
-- Separate StatefulSets or Deployments for Redis and Sentinel
-- with Sentinel configured to monitor the Redis StatefulSet pods
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: redis-sentinel
Real-world example A company running a critical application on Kubernetes deploys both Redis and Sentinel together, achieving automatic failover within their cluster without needing to manage failover logic manually, even when a specific pod or node fails.

Common follow-ups: How do liveness and readiness probes need to be configured differently for Redis versus Sentinel pods?;What happens during a Kubernetes node failure that was hosting the current Redis primary?