BigBitBusInc / kubernetes-automation-toolkit

This repository contains code examples and documentation for learning how applications can be developed with Kubernetes
https://www.bigbitbus.com/
Other
57 stars 11 forks source link

postgresql db user and password config does't work #16

Open gongpengjun opened 2 years ago

gongpengjun commented 2 years ago

postgresqlPassword: B1gB1tBu5 does NOT work as expected.

gongpengjun@mbp kubernetes-automation-toolkit$ vagrant ssh
Last login: Wed Feb 23 14:12:58 2022 from 10.0.2.2
vagrant@ubuntu2004:~$ kubectl get secret --namespace pg pgdb-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode;echo
P2zJdANSBT

vagrant@ubuntu2004:~$ microk8s kubectl get pods -n pg
NAME                READY   STATUS    RESTARTS   AGE
pgdb-postgresql-0   1/1     Running   0          12h
vagrant@ubuntu2004:~$ microk8s kubectl exec -it pgdb-postgresql-0 -n pg -- bash
I have no name!@pgdb-postgresql-0:/$ env|grep POSTGRES_
POSTGRES_PASSWORD=P2zJdANSBT
I have no name!@pgdb-postgresql-0:/opt/bitnami/postgresql/bin$ psql -U "postgres" -h 127.0.0.1 -p 5432
Password for user postgres: P2zJdANSBT
psql (11.9)
Type "help" for help.

postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

vagrant_up.log

gongpengjun commented 2 years ago

Work around the error by login postgresql and create database and user mannually

postgres=# create database "todo-postgres-db";
postgres=# create user dbuser with encrypted password 'B1gB1tBu5';
postgres=# grant all privileges on database "todo-postgres-db" to dbuser;