StackGres Containers is here: Postgres images à la carte. Try it

Architecture

The Cluster

A StackGres cluster is basically a StatefulSet where each pod is a database instance. The StatefulSet guarantees that each pod is always bound to its own persistent volume. Therefore, the database instance data will be mapped to the state of a Patroni instance inside kubernetes.

StackGres Cluster Architecture diagram

StackGres architecture: the controller and REST API, the web console, the distributed log server and the cluster pods StackGres Controller REST API kubectl CRDs REST API Users StackGres UI Kubernetes API Distributed Log Server Fluentd Postgres + Timescale PV Service Primary 5432 Clients RW Service Replicas 5432 Clients RO Pod-0 role = primary PV Pod-1 role = replica PV Pod-2 role = replica PV

StackGres Pod Architecture diagram

We use a pattern called sidecar where a main application runs in a container and other containers co-located in the same pod are providing side functionalities like connection pooling, export of stats, edge proxying, logging dispatcher or database utilities.

Anatomy of the pod: Envoy, PgBouncer, Patroni and Postgres with their sidecars, linked over Unix domain sockets To Replicas Postgres repl. port 5433 Postgres port 5432 To Clients Envoy Proxy UDS UDS To Prometheus UDS PgBouncer UDS Patroni + Postgres UDS Replication Logs Backup Agent (Job) To S3, GCS, Azure Blob, MinIO, … Local Pod Controller Fluent-bit Send logs to Fluentd UDS Postgres Util UDS Postgres Exporter To Prometheus PVC PV (EBS, PD, …)

UDS: Unix Domain Socket