Cloud Native 18 min read

Getting Started with StackGres 1.6: Key Features and Quick Deployment

This article introduces StackGres 1.6’s core capabilities—including declarative Kubernetes CRDs, default tuning, custom configurations, high‑availability with Patroni, automated backups, server‑side connection pooling, distributed logging, observability, and a web UI—and provides a step‑by‑step quick‑start guide to install the operator, create a PostgreSQL cluster, and access it via psql, services, or the UI.

Hacker Afternoon Tea
Hacker Afternoon Tea
Hacker Afternoon Tea
Getting Started with StackGres 1.6: Key Features and Quick Deployment

StackGres 1.6 Feature Overview

StackGres is a PostgreSQL platform built as a Kubernetes operator. All management actions are expressed through custom resources (CRDs), enabling infrastructure‑as‑code and GitOps workflows.

Declarative K8s CRs

The operator stores the desired state in the spec section of a CRD and reports results in status. Defining a StackGres cluster with kubectl makes you a PostgreSQL expert.

Default Tuning

Clusters are created with a production‑ready configuration tuned by the OnGres DBA team, so even non‑experts can run a ready‑to‑use PostgreSQL instance.

Custom Configuration

Advanced users can supply custom SGPostgresConfig CRDs to override defaults without risking cluster crashes.

Full PostgreSQL User Access

The postgres superuser is available with unrestricted privileges.

High Availability

StackGres integrates Patroni for automatic failover and recovery. A read‑write (primary) and read‑only (replica) service are exposed, and failover occurs within seconds without manual intervention.

Automated Backups

Continuous‑archive backups enable zero‑data‑loss recovery and point‑in‑time restores. Backups are stored in cloud object storage (S3, GCS, Azure Blob) or on‑prem MinIO.

Server‑Side Connection Pooling

PgBouncer runs as a sidecar container, exporting metrics to Prometheus and visualising them in Grafana. Pooling can be tuned or disabled via SGPoolingConfig.

Distributed Logs

FluentBit and Fluentd collect PostgreSQL and Patroni logs, forward them to a TimescaleDB‑enhanced log database, and make them queryable via SQL or the web console.

Observability

StackGres ships an Envoy PostgreSQL filter that decodes the wire protocol and emits PostgreSQL‑specific metrics to Prometheus, displayed on built‑in Grafana dashboards.

Web UI Management Console

The UI mirrors all CRD operations, supports RBAC/SSO authentication, and provides a REST API for automation.

Day‑2 Operations

Version upgrades, container upgrades, controlled restarts, vacuum, and repack are performed declaratively by applying the desired state to CRDs.

Advanced Replication Modes

Supports asynchronous, synchronous, and group replication, including cascading and standby clusters.

Sharding (Citus) and Extensions

Patroni + Citus + PgBouncer deliver one‑click high‑availability sharding. StackGres bundles over 150 PostgreSQL extensions, the largest collection among PostgreSQL platforms.

Ecosystem

The project is 100 % open source, with repositories on GitLab and GitHub, an issue tracker, Slack, Discord, and optional 24/7 enterprise support.

Quick‑Start Guide

Install the Operator

kubectl apply -f https://stackgres.io/downloads/stackgres-k8s/stackgres/1.6.0/stackgres-operator-demo.yml

This creates the stackgres namespace and all required resources.

Wait for the Operator

kubectl get pods -n stackgres

Pods should show Running status.

Create a Cluster

cat <<'EOF' | kubectl create -f -
apiVersion: stackgres.io/v1
kind: SGCluster
metadata:
  name: simple
spec:
  instances: 1
  postgres:
    version: 'latest'
  pods:
    persistentVolume:
      size: '5Gi'
EOF

This creates a single‑node PostgreSQL cluster with default storage.

Verify the Cluster

kubectl get pods --watch

Wait until the pod simple-0 reaches Running.

Access via psql

kubectl exec -ti "$(kubectl get pod --selector app=StackGresCluster,stackgres.io/cluster=true,role=master -o name)" -c postgres-util -- psql

The postgres superuser is available inside the postgres-util sidecar.

Access via Kubernetes Service

kubectl get secret simple --template '{{ printf "%s" (index .data "superuser-password" | base64decode) }}'

Use the retrieved password with psql -h simple postgres postgres from any pod.

Login to the Web UI

POD_NAME=$(kubectl get pods -n stackgres -l "stackgres.io/restapi=true" -o jsonpath="{.items[0].metadata.name}")
kubectl port‑forward "$POD_NAME" 8443:9443 -n stackgres

Open https://localhost:8443/admin/ and log in with the admin user and the auto‑generated password retrieved from the stackgres-restapi-admin secret.

Cleanup

kubectl delete --ignore-not-found -f https://stackgres.io/downloads/stackgres-k8s/stackgres/1.6.0/stackgres-operator-demo.yml

Refer to the uninstall guide for additional details.

References

CRD reference: https://stackgres.io/doc/latest/reference/crd/

Getting started: https://stackgres.io/doc/latest/quickstart/

Patroni: https://github.com/zalando/patroni

PgBouncer: https://www.pgbouncer.org/

FluentBit: https://fluentbit.io/

Fluentd: https://www.fluentd.org/

Envoy PostgreSQL filter: https://www.cncf.io/blog/2020/08/13/envoy-1-15-introduces-a-new-postgres-extension-with-monitoring-support/

GitLab repo: https://gitlab.com/ongresinc/stackgres

GitHub mirror: https://github.com/ongres/stackgres

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

OperatorBackupcrd
Hacker Afternoon Tea
Written by

Hacker Afternoon Tea

You might find something interesting here ^_^

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.