Update Password procedure for mongo, minio, redis, postgresql
Mongo
To change the password for Mongo, please follow these steps.
login to the
mongo-client
pod by exec'ing into it ( you can get these instructions to run mongo client pod by runninghelm -n ef-external status mongo
and follow along the instructions printed)
kubectl -n ef-external exec -it mongo-mongodb-client -- bash
login to the mongo using existing password
mongosh admin --host "mongo-mongodb" --authenticationDatabase admin -u root -p <EXISTING_MONGO_ROOT_PASSWORD> --tls --tlsAllowInvalidHostnames --tlsAllowInvalidCertificates --tlsCertificateKeyFile /tongo/combined.pem --tlsCAFile /tmp/mongo/client-pem
once inside the mongo shell, assign the
db
variable to detailed information ofadmin
db where all password related information is saved
db = db.getSiblingDB('admin')
then change the password
db.changeUserPassword("root", "NEWPASSWORD")
logout of the
mongosh
and try to reconnect with the new password
mongosh admin --host "mongo-mongodb" --authenticationDatabase admin -u root -p <NEW_MONGO_ROOT_PASSWORD> --tls --tlsAllowInvalidHostnames --tlsAllowInvalidCertificates --tlsCertificateKeyFile /tongo/combined.pem --tlsCAFile /tmp/mongo/client-pem
PostgreSQL
to change the postgresql password, please follow these steps
launch the postgresql client pod
CODEkubectl run ef-postgresql-client \ --namespace ef-external \ --image docker.io/bitnami/postgresql:16.2.0-debian-12-r6 \ --env="PGPASSWORD=$POSTGRES_PASSWORD" \ --command -- sleep infinity
exec into the client pod
kubectl -n ef-external exec -it ef-postgresql-client -- /opt/bitnami/scripts/postgresql/entrypoint.sh /bin/bash
To change the postgres
user's password
psql --host ef-postgresql -U postgres -W # when propmted for password enter postgres user's existing password
postgres=# alter user postgres with password 'NEW_PASSWORD';
postgresl=# \q
To change the sa
user’s password
psql --host ef-postgresql -U postgres -W # when propmted for password enter postgres user's existing password
postgres=# alter user sa with password 'NEW_PASSWORD';
postgresl=# \q
exit the client pod
exit
Redis
Redis server does not allow the password to be changed during runtime without restarting the pod because the password is always saved in the redis.conf file. To change the redis password, change the password in the helm chart’s values.yaml
file and run the helm upgrade
command used to deploy the helm chart.
minio
Minio requires the accesskey and secretkey parameters at the start, which are not changeable during the runtime. To change these parameters, update the helm chart with required change and restart the deployment using helm upgrade
command used when depolying the solution