Description of the feature I encountered an issue while deploying Redis on Kubernetes using a YAML manifest. I aimed to set up a custom Redis username and password via environment variables, but Redis does not support an environment variable for setting a custom username directly.
Expected Behavior The custom Redis username should be set directly using the REDIS_USERNAME environment variable, similar to how REDIS_PASSWORD is used.
Alternatives I've considered Redis does not have a built-in environment variable for setting a custom username. As a workaround, I had to log in to the Redis server using the default user and then create the custom user using ACL commands within an initialization script.
This is how I am creating a custom user from yaml.
command:
- "sh"
- "-c"
args:
- "nohup sh -c 'sleep 15 && redis-cli -a $REDIS_PASSWORD ACL SETUSER $REDIS_USERNAME on +@all ~* \\>$REDIS_PASSWORD' & redis-server --requirepass $REDIS_PASSWORD"
Comment From: prabhash-varma-cai
@sundb Do you have any idea on this?
Comment From: sundb
@prabhash-varma do you mean you want a feature that can create a acl user automatic? like --requirepass?
Comment From: prabhash-varma
@sundb Yes, similar to how we set up password from yaml using 'REDIS_PASSWORD' env variable. It will be highly appreciated and useful if you come up with this feature.
Comment From: sundb
@prabhash-varma sorry, i'm not sure this is a good idea to create a acl user through config.
we already have the aclfile config, and we can change the config to your self acl file that contains a default user you created in advance.