cetic / helm-postgresql

Helm Chart for postgresql
Apache License 2.0
47 stars 33 forks source link

connecting to postgre #17

Closed mdemarco1234 closed 1 year ago

mdemarco1234 commented 2 years ago

I have loaded both postgre and pgadmin into a Minikube cluster and I ran the pgadmin gui but when trying to configure a server through the pgadmin UI I can't. What is the is ip of the host. I did see the helm charts values.yaml file but that don't work and my suspicion is that because we are in a ui there is no connection to the pod where postgre is running and I did port forward and it still does not make connection. how is this solved? In general, how does one pod running an application connect to the pod where postgre is running? What is the connection string? If I want to access the postgre running in MiniKube what commands can I use in the Bash console to access it

banzo commented 1 year ago

The helm install command outputs that information, for example:

    ~  helm install my-release cetic/postgresql                                                                                                                      1 ✘  minikube ⎈ 
NAME: my-release
LAST DEPLOYED: Mon Jan 16 15:26:30 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **

PostgreSQL can be accessed via port 5432 on the following DNS name from within your cluster:

    my-release-postgresql.default.svc.cluster.local - Read/Write connection

To get the password for "postgres" run:

    export POSTGRES_PASSWORD=$(kubectl get secret --namespace default my-release-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

    kubectl run my-release-postgresql-client --rm --tty -i --restart='Never' --namespace default --image postgres --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host my-release-postgresql -U postgres -d postgres -p 5432

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/my-release-postgresql 5432:5432 &
    PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -d postgres -p 5432