From d66c652802b62700cc24f32c44ff2b5fc45debb5 Mon Sep 17 00:00:00 2001 From: wejdross Date: Mon, 21 Aug 2023 13:13:00 +0200 Subject: [PATCH] docs explaining how to connect to PSQL in various ways (#81) * 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 <121873045+lieneluksika@users.noreply.github.com> * Update docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc Co-authored-by: lieneluksika <121873045+lieneluksika@users.noreply.github.com> --------- Co-authored-by: lukasz.widera@vshn.ch Co-authored-by: lieneluksika <121873045+lieneluksika@users.noreply.github.com> --- docs/modules/ROOT/nav.adoc | 1 + .../vshn-managed/postgresql/connect.adoc | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index d7fe7dc..c9ed725 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -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] diff --git a/docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc b/docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc new file mode 100644 index 0000000..c2087bf --- /dev/null +++ b/docs/modules/ROOT/pages/vshn-managed/postgresql/connect.adoc @@ -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]