Skip to content

Commit

Permalink
docs explaining how to connect to PSQL in various ways (#81)
Browse files Browse the repository at this point in the history
* docs explaining how to connect to PSQL in various ways

* fixing docs

* Update docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc

Co-authored-by: lieneluksika <[email protected]>

* Update docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc

Co-authored-by: lieneluksika <[email protected]>

---------

Co-authored-by: [email protected] <[email protected]>
Co-authored-by: lieneluksika <[email protected]>
  • Loading branch information
3 people authored Aug 21, 2023
1 parent 9d77f2a commit d66c652
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* xref:vshn-managed/postgresql/index.adoc[On cloudscale.ch]
** xref:vshn-managed/postgresql/create.adoc[Creation]
** xref:vshn-managed/postgresql/usage.adoc[Usage]
** xref:vshn-managed/postgresql/connect.adoc[Connect]
** xref:vshn-managed/postgresql/delete.adoc[Deletion]
** xref:vshn-managed/postgresql/backup.adoc[Backup]
** xref:vshn-managed/postgresql/restore.adoc[Restore]
Expand Down
50 changes: 50 additions & 0 deletions docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
== How to connect to Your instance ==

=== Problem

You want to either connect to your PostgreSQL cluster from outside of the cluster or need to port-forward so that you can use your favorite database management tool.


=== LoadBalancer

WARNING: While using LoadBalancer additional charges may apply for additional IPv4 address. https://products.vshn.ch/appuio/cloud/pricing.html#_service_type_loadbalancer[Check pricing]

LoadBalncer service type is supported on LPG-2 Appuio Cluster and You can use it by setting:
```
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNPostgreSQL
metadata:
name: my-postgresql
namespace: app1-dev
spec:
parameters:
network:
serviceType: LoadBalancer
backup:
deletionProtection: false
writeConnectionSecretToRef:
name: my-postgresql-dev-connection
```

This YAML snippet would create a PostgreSQL cluster and Service of type LoadBalancer. The Service would be accessible from outside of the cluster. You can get IP address of the service using either:
```
kubectl -n $instanceNamespace get service primary-service
```
link:../how-tos/logging.adoc[Check how to find instanceNamespace]

or access it directly from connection secret

```
kubectl -n app1-dev get secrets my-postgresql-dev-connection -o yaml | yq .data.LOADBALANCER_IP | base64 -d
```

=== Port-forward

TIP: This is the default serviceType

You can port-forward to your PostgreSQL cluster using kubectl port-forward command. This command works always, no matter what is set as serviceType.

```
kubectl -n $instanceNamespace port-forward services/primary-service 5432
```
link:../how-tos/logging.adoc[Check how to find instanceNamespace]

0 comments on commit d66c652

Please sign in to comment.