diff --git a/docs/user.md b/docs/user.md index a0569fe2b6a87566821a9178e9c8706c9734c743..bab09f8c950920654c40d7aeb39acc8cd3d8d33e 100644 --- a/docs/user.md +++ b/docs/user.md @@ -43,13 +43,25 @@ $ kubectl get pods -w --show-labels ## Connect to PostgreSQL -We can use the generated secret of the `postgres` robot user to connect to our `acid-minimal-cluster` master running in Minikube: +With a `port-forward` on one of the database pods (e.g. the master) you can +connect to the PostgreSQL database. Use labels to filter for the master pod of +our test cluster. + +```bash +# get name of master pod of acid-minimal-cluster +export PGMASTER=$(kubectl get pods -o jsonpath={.items..metadata.name} -l application=spilo,version=acid-minimal-cluster,spilo-role=master) + +# set up port forward +kubectl port-forward $PGMASTER 6432:5432 +``` + +Open another CLI and connect to the database. Use the generated secret of the +`postgres` robot user to connect to our `acid-minimal-cluster` master running +in Minikube: ```bash -$ export PGHOST=db_host -$ export PGPORT=db_port $ export PGPASSWORD=$(kubectl get secret postgres.acid-minimal-cluster.credentials -o 'jsonpath={.data.password}' | base64 -d) -$ psql -U postgres +$ psql -U postgres -p 6432 ``` # Defining database roles in the operator