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 | {}