Changing Database Passwords
Resetting Passwords
The following procedure walks through the process of changing passwords for the database users in the Immuta Database.
The commands outlined here will need to be altered depending on your Helm release name and chosen passwords. Depending on your environment, there may be other changes required for the commands to complete successfully, including, but not limited to, Kubernetes namespace, kubectl context, and Helm values file name.
This process results in downtime.
Helm Values
-
Scale database
StatefulSetto 1 replica:kubectl scale statefulset <release-name>-immuta-database --replicas 1 -
Change
database.superuserPassword:- Alter Postgres user password:
kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER postgres WITH ENCRYPTED PASSWORD '<new-password>'"- Update
database.superuserPasswordwith<new-password>inimmuta-values.yaml.
-
Change
database.replicationPassword:- Alter replicator user password:
kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER replicator WITH ENCRYPTED PASSWORD '<new-password>'"- Update
database.replicationPasswordwith<new-password>inimmuta-values.yaml.
-
Change
database.password:- Alter
bometauser password:
kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER bometa WITH ENCRYPTED PASSWORD '<new-password>'"- Update
database.passwordwith<new-password>inimmuta-values.yaml.
- Alter
-
Update
database.patroniApiPasswordwith<new-password>inimmuta-values.yaml. -
Run
helm upgradeto persist the changes and scale the databaseStatefulSetup:helm upgrade --reuse-values <release-name> immuta/immuta -
Restart web pods:
kubectl rollout restart deployment/<release-name>-immuta-web
Kubernetes Secret
Users have the option to use an existing Kubernetes secret for Immuta database passwords used in Helm installations.
-
Update your
existingSecretvalues in your Kubernetes environment. -
Get the current replica counts:
DATABASE_REPLICA_COUNT=$(kubectl get statefulset --selector "app.kubernetes.io/component=database" --output=jsonpath='{.items[0].status.replicas}') -
Scale database
StatefulSetto 1 replica:kubectl scale statefulset <release-name>-immuta-database --replicas 1 -
Change the value corresponding to
database.superuserPasswordin the existing Kubernetes Secret. -
Alter Postgres user password:
kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER postgres WITH ENCRYPTED PASSWORD '<new-password>'" -
Change the value corresponding to
database.replicationPasswordin the existing Kubernetes Secret. -
Alter replicator user password:
kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER replicator WITH ENCRYPTED PASSWORD '<new-password>'" -
Change the value corresponding to
database.passwordin the existing Kubernetes Secret. -
Alter
bometauser password:kubectl exec <release-name>-immuta-database-0 -- \ psql -d bometadata -c \ "ALTER USER bometa WITH ENCRYPTED PASSWORD '<new-password>'" -
Scale the immuta-database
StatefulSetup to the previous replica count determined in the previous step:kubectl scale statefulset <release-name>-immuta-database --replicas $DATABASE_REPLICA_COUNT -
Restart web pods:
kubectl rollout restart deployment/<release-name>-immuta-web