You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace REDIS_PASSWORD with REDISCLI_AUTH in redis-cli commands
Problem
Using -a in redis-cli triggers warnings that clutter logs:
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
Also exposes passwords in process lists.
Here you can see password clear text
{"level":"error","ts":"2025-12-03T22:05:56Z","msg":"Could not execute command","controller":"rediscluster","controllerGroup":"redis.redis.opstreelabs.in","controllerKind":"RedisCluster","RedisCluster":{"name":"my-redis-cluster","namespace":"redis"},"namespace":"redis","name":"my-redis-cluster","reconcileID":"3da66c06-5474-457f-8a85-ed454f8f8764","Command":["redis-cli","--cluster","create","172.16.118.120:6379","172.16.177.178:6379","172.16.118.25:6379","--cluster-yes","-a","password"],"Output":">>> Performing hash slots allocation on 3 nodes...\nMaster[0] -> Slots 0 - 5460\nMaster[1] -> Slots 5461 - 10922\nMaster[2] -> Slots 10923 - 16383\nM: c30a9996ba9fe82b14446dfb4cf67aaddec629ee 172.16.118.120:6379\n slots:[0-5460] (5461 slots) master\nM: 8cfc54bb1f1f58a170ebf3601348f8f3f186e079 172.16.177.178:6379\n slots:[5461-10922] (5462 slots) master\nM: e4bfe6da8d02d1fa050a85222db449d2fb3ce387 172.16.118.25:6379\n slots:[10923-16383] (5461 slots) master\n>>> Nodes configuration updated\n>>> Assign a different config epoch to each node\n>>> Sending CLUSTER MEET messages to join the cluster\nWaiting for the cluster to join\n.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................","error":"execute command with error: command terminated with exit code 137, stderr: Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.\n","stacktrace":"github.com/OT-CONTAINER-KIT/redis-operator/internal/k8sutils.executeCommand\n\t/workspace/internal/k8sutils/redis.go:575\ngithub.com/OT-CONTAINER-KIT/redis-operator/internal/k8sutils.ExecuteRedisClusterCommand\n\t/workspace/internal/k8sutils/redis.go:259\ngithub.com/OT-CONTAINER-KIT/redis-operator/internal/controller/rediscluster.(*Reconciler).Reconcile\n\t/workspace/internal/controller/rediscluster/rediscluster_controller.go:229\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.2/pkg/internal/controller/controller.go:119\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.2/pkg/internal/controller/controller.go:316\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.2/pkg/internal/controller/controller.go:266\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2\n\t/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.17.2/pkg/internal/controller/controller.go:227"}
Solution
Use REDISCLI_AUTH env var instead - redis-cli reads it automatically without warnings.
# Current
redis-cli -a "${REDIS_PASSWORD}" ping
# Proposed
redis-cli ping
Considerations
version compatibility for REDISCLI_AUTH
Cleaner, no warnings, more secure. Keep REDIS_PASSWORD for applications, add REDISCLI_AUTH for CLI operations.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Replace REDIS_PASSWORD with REDISCLI_AUTH in redis-cli commands
Problem
Using
-ain redis-cli triggers warnings that clutter logs:Also exposes passwords in process lists.
Here you can see
passwordclear textSolution
Use
REDISCLI_AUTHenv var instead - redis-cli reads it automatically without warnings.Considerations
Cleaner, no warnings, more secure. Keep
REDIS_PASSWORDfor applications, addREDISCLI_AUTHfor CLI operations.Beta Was this translation helpful? Give feedback.
All reactions