Pre-requisites

As explained in the Demo section, for setting up the Operator and StackGres Cluster, you need to have an environment on top of which it needs to request the necessary resources.

StackGres 1.x is able to run on any Kubernetes installation from 1.16 to 1.19 version, if you need support for older Kubernetes please use the 0.9.x branch that it’s on maintainance mode.

  • K8s Environments
  • Details about how to setup specific Kubernetes environments to work with StackGres.

    • Rancher RKE
    • Rancher Kubernetes Engine (RKE) is a CNCF-certified Kubernetes distribution that runs entirely within Docker containers.

  • Data Storage
  • Details about how to setup and configure the storage classes. Storage classes are used by the database clusters and will impact performance and availability of the cluster.

  • Backups
  • Details about how to setup and configure the backups

  • Monitoring
  • Details about how to setup and configure prometheus

    • Connecting to the Cluster
    • This page contains details about how to connect on the StackGres cluster.

    • Customize Postgres Configuration
    • StackGres operator creates default configurations in the same namespace where the operator has been installed. Those configuration CRs are read-only and can only be modified by the operator itself. User can create modified version of those default configurations by creating one in the same namespace where the cluster will be created. When configuration resource is created the operator will look for a default configuration in the same namespace as the operator.

    • Customize Connection Pooling Configuration
    • If you happen to be reading this, it’s because you are aware of your application characteristics and needs for scaling connections on a production environment. A simple way to target this correctly, is to verify the usage of Prepared Statements, on top of which session mode will be the only compatible. Some applications, do not handle connection closing properly, which may require to add certain timeouts for releasing server connections.

    • Database Extensions
    • All extensions can be created with a regular CREATE EXTENSION command. To create then, connect on the database through psql then run: postgres=# CREATE EXTENSION pg_stat_statements; CREATE EXTENSION Check here for more details about how to connect using kubectl. Checking available extensions Besides the standard PostgreSQL extensions, StackGres ships with the following extensions: PostGIS TimescaleDB pgbouncer_fdw pgsphere pg_repack pg_healpix pg_q3c Check the current version on the releases page.

    • Patroni Management
    • Once you hace a StackGres cluster installed you’ll have a Full HA PostgreSQL configuration and depending of the size of your cluster you´ll have something like this: These represents the containers of the StackGres cluster and you can list them using kubectl command like: kubectl get pods -n default -l app=StackGresCluster,cluster=true Note: Change -n param to point to your namespace, in this example we use default. And we’ll get an output like:

    • Monitoring metrics
    • Contains details about the metrics automatically stored on Prometheus.

    • Database passwords
    • Describes how to get the auto-generated database passwords.

    • Cluster Restart
    • This procedure can be used in general after a configuration change that requires restart (including postgres, pgbouncer or any configuration of the StackGres cluster). As a reference, a restart is required when the cluster condition PendingRestart inside .status.conditions property is True. kubectl get sgclusters.stackgres.io -A --template ' {{- range $item := .items }} {{- range $item.status.conditions }} {{- if eq .type "PendingRestart" }} {{- printf "%s.%s %s=%s\n" $item.metadata.namespace $item.metadata.name .type .

    • Uninstall
    • Uninstalling StackGres clusters Database clusters Assuming that your cluster is running on the default namespace, execute the commands below to find and delete the clusters: ## List the available clusters ❯ kubectl get sgcluster -n default NAME AGE my-db-cluster 4m27s ## List the pods for the cluster ❯ kubectl get pods NAME READY STATUS RESTARTS AGE my-db-cluster-0 5/5 Running 1 2m29s my-db-cluster-1 5/5 Running 1 99s my-db-cluster-2 5/5 Running 0 74s ## Delete the cluster ❯ kubectl delete sgcluster my-db-cluster -n default sgcluster.

  • Non production options
  • Important notes for Non production options in the productiom environment

  • Service mesh integration
  • Service mesh integration Details about the different options to integrate StackGres with some service mesh implementations. Istio Details about how to work in a k8s cluster with Istio

    • Istio
    • Details about how to work in a k8s cluster with Istio