-
Notifications
You must be signed in to change notification settings - Fork 80
How To change noobaa PostgreSQL password in Kubernetes
Danny Zaken edited this page Jan 17, 2022
·
1 revision
-
Stop
noobaa-operator
pod from runningkubectl scale deployment noobaa-operator --replicas 0
-
Stop
noobaa-core
andnoobaa-endpoint
kubectl scale statefulset noobaa-core --replicas 0 kubectl scale deployment noobaa-endpoint --replicas 0
-
Go into
noobaa-db-pg-0
pod and change the password for usernoobaa
inpsql
kubectl exec -it noobaa-db-pg-0 -- bash psql -d nbcore ALTER USER noobaa WITH PASSWORD 'myNewPassword';
-
Change the password in
noobaa-db
secret which holds the Postgres credentials for all other pods.
the best way to do that is to addstringData
object to the secret. The values instringData
will be encoded as base64 automaticallyk edit secrets noobaa-db
e.g.
# Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: v1 data: password: YmxhYmxh user: bm9vYmFh stringData: # <<<===== add stringData password: "myNewPassword" # <<<===== write new password as string (not base64) kind: Secret metadata: creationTimestamp: "2022-01-16T08:39:57Z" labels: app: noobaa name: noobaa-db namespace: test-58 ownerReferences: - apiVersion: noobaa.io/v1alpha1 blockOwnerDeletion: true controller: true kind: NooBaa name: noobaa uid: 0e313a83-7a0e-43d6-94b0-a7a12845ee5e resourceVersion: "45172" uid: 57c09bb0-8f31-4c29-9f84-933cb46f9d78 type: Opaque
after saving this should look like this:
apiVersion: v1 data: password: bXlOZXdQYXNzd29yZA== # <<<==== new password in base64 user: bm9vYmFh kind: Secret metadata: creationTimestamp: "2022-01-16T08:39:57Z" labels: app: noobaa name: noobaa-db namespace: test-58 ownerReferences: - apiVersion: noobaa.io/v1alpha1 blockOwnerDeletion: true controller: true kind: NooBaa name: noobaa uid: 0e313a83-7a0e-43d6-94b0-a7a12845ee5e resourceVersion: "45804" uid: 57c09bb0-8f31-4c29-9f84-933cb46f9d78 type: Opaque
-
Restart all pods
kubectl scale deployment noobaa-endpoint --replicas 1 kubectl scale statefulset noobaa-core --replicas 1 kubectl scale deployment noobaa-operator --replicas 1