- Home
- Installation Guide
- Install MSR with High Availability
- Install Highly Available Cache
- Install Highly Available Valkey (preferred)
- Install highly available Valkey with Sentinel
Install highly available Valkey with Sentinel#
In the Valkey with Sentinel architecture, Sentinel nodes monitor the Valkey primary and replica nodes and automatically promote a replica if the primary fails. MSR 4 queries Sentinel to find the current primary, so it continues to work after a failover. Valkey with Sentinel requires Valkey Helm chart 1.0.0 or later.
Deploy Valkey with Sentinel#
-
Generate a strong, random password for authenticating with Valkey:
PASSWORD=$(LC_ALL=C tr -dc A-Za-z0-9 </dev/urandom | head -c 24) -
Create a Kubernetes secret to securely store the password:
kubectl create secret generic msr-valkey-secret \ --from-literal=REDIS_PASSWORD=${PASSWORD}Note
MSR 4 requires
REDIS_PASSWORDas the password field name. -
Deploy the Valkey with Sentinel instance in the MSR 4 namespace:
helm install msr-valkey oci://registry.mirantis.com/harbor/helm/mirantis-valkey/valkey \ --version 1.0.0 \ --set replica.enabled=true \ --set replica.replicas=3 \ --set persistence.enabled=true \ --set persistence.size=10Gi \ --set auth.enabled=true \ --set auth.usersExistingSecret=msr-valkey-secret \ --set auth.aclUsers.default.passwordKey=REDIS_PASSWORD \ --set "auth.aclUsers.default.permissions=~* &* +@all" \ --set sentinel.enabled=true \ --set sentinel.replicas=3 \ --set sentinel.auth.enabled=false \ --set networkPolicy.enabled=true \ --set "networkPolicy.ingressNSMatchLabels.kubernetes\.io/metadata\.name=<msr-namespace>"Configuration considerations:
- The
replica.replicasvalue specifies the total number of Valkey nodes, including the primary node. Thesentinel.replicasvalue specifies the number of Sentinel nodes. The default is3. -
MSR 4 cannot authenticate to Sentinel, so set
sentinel.auth.enabled=false. The chart then requiresnetworkPolicy.enabled=trueand allows access to the Sentinel port only from the following sources:- The Valkey and Sentinel pods of the release
- Pods labeled
msr-valkey-client: "true" - The namespace set in
networkPolicy.ingressNSMatchLabels, which must be the MSR 4 namespace
This protection applies only if your cluster network plugin enforces NetworkPolicies.
- The
-
Retrieve the connection details for the Valkey service:
-
Get the Sentinel master name:
kubectl exec msr-valkey-sentinel-0 -- valkey-cli -p 26379 --raw SENTINEL MASTERS | sed -n 2p -
Get the name and port number of the Sentinel headless service:
kubectl get svc | grep valkeyExample output:
msr-valkey ClusterIP <cluster-ip> <none> 6379/TCP 34s msr-valkey-headless ClusterIP None <none> 6379/TCP 34s msr-valkey-read ClusterIP <cluster-ip> <none> 6379/TCP 34s msr-valkey-sentinel ClusterIP <cluster-ip> <none> 26379/TCP 34s msr-valkey-sentinel-hl ClusterIP None <none> 26379/TCP 34sIn the example above,
msr-valkey-sentinel-hlis the Sentinel headless service, which uses port 26379.
-
-
In
values.yaml, configure the Redis connection fields using the Sentinel service, port, and master name:- The
addrvalue specifies a comma-separated list of Sentinel pod addresses in the<pod-name>.<headless-service-name>.<namespace>.svc.cluster.local:<port>format. In the example below, replacedefaultwith your MSR 4 namespace. - The
sentinelMasterSetvalue specifies the master name defined during the Sentinel deployment. The default ismymaster.
Example configuration:
redis: type: external external: addr: "msr-valkey-sentinel-0.msr-valkey-sentinel-hl.default.svc.cluster.local:26379,msr-valkey-sentinel-1.msr-valkey-sentinel-hl.default.svc.cluster.local:26379,msr-valkey-sentinel-2.msr-valkey-sentinel-hl.default.svc.cluster.local:26379" existingSecret: msr-valkey-secret sentinelMasterSet: "mymaster" - The
Enable Sentinel on an Existing Valkey Deployment with Replication#
-
Run the
helm upgradecommand from Upgrade Valkey with Sentinel against the existingmsr-valkeyrelease:- If the release uses chart version 0.x, set
--versionto 1.0.0 or later. In that case, do not use--reuse-values. - With
replica.replicas=3, the upgrade keeps the existing primary and the two replicas. The data volumes stay in place.
- If the release uses chart version 0.x, set
-
Update the MSR 4 Redis configuration as described in step 5 of Deploy Valkey with Sentinel.
-
Apply the updated configuration to MSR 4, setting
--versionto the MSR 4 version that you run:helm upgrade <release-name> oci://registry.mirantis.com/harbor/helm/msr \ --version <msr-version> \ -f values.yamlUntil MSR 4 uses Sentinel, it can send writes to a replica and some requests can fail.