1. By default the postgresql password is saved as a kubernetes secret. To get the secret name you can run kubectl get secrets. To decode the password in the secret you can run the command below after providing the postgresql secret name.
kubectl get secret -n <namespace> <postgresql_secret_name> -o jsonpath="{.data.postgresql-password}" | base64 --decode2. Once you obtain the password, you can now log into the database inside the postgresql pod. Below is the command to get a shell on the running postgresql pod.
kubectl exec -it artifactory-postgresql-0 bash
3. Run psql inside the postgresql pod to login to the database using the previously retrieved password. The default username is artifactory.
psql -U artifactory password=<postgresql_password>