PostgreSQL
Overview
PostgreSQL is a powerful, open-source relational database system known for its reliability, feature richness, and extensibility. It supports advanced SQL compliance, transactional integrity, and scalability, making it a popular choice for both OLTP and OLAP workloads. PostgreSQL’s flexibility allows for use across a wide range of applications, from web services to large-scale data platforms.Apolo uses the Crunchy Data distribution of PostgreSQL, which builds on the core database engine by adding production-grade features such as high availability, automated backups, Kubernetes-native deployment, and enhanced monitoring. This ensures that PostgreSQL on Apolo is robust, secure, and ready for mission-critical workloads in modern cloud environments.
PostgreSQL comes with integrated PgBouncer, which sits between your application and PostgreSQL, managing and reusing database connections to reduce overhead and improve performance—especially in high-concurrency environments.
Key Features
Enterprise-Grade PostgreSQL: Fully open-source and compliant with PostgreSQL, offering advanced tooling and support for critical workloads.
High Availability: Built-in support for HA via Patroni, Kubernetes-native failover handling, and synchronous streaming replication.
Automated Backups & Point-in-Time Recovery (PITR): Integrated tools for automated scheduled backups, WAL archiving, and recovery to any point.
Monitoring & Metrics: Native integration with Prometheus and Grafana for visibility into database performance and health.
Security & Compliance: Includes features such as TLS encryption, role-based access control, audit logging, and SELinux hardening.
Kubernetes-Native: Optimized for Kubernetes through Crunchy Data’s PostgreSQL Operator (PGO), enabling declarative management and scalable deployments.
Installing
As with other applications on Apolo, you can deploy Crunchy PostgreSQL cluster via web console, or using Apolo CLI.
Highlights of the installation flow
Resource presets: select the resource preset (e.g.
cpu-medium
,cpu-large
) that defines hardware requirements (CPU, memory, etc.) for the PostgreSQL server or PG bouncer.Persistent Storage Management: we automatically provisions high-performance, durable storage with snapshot and backup support.
Backup & PITR Support: we integrate your setup with Apolo buckets to configure backup system for regular snapshots and point-in-time recovery options.
RBAC: you can preconfigure list of databases and users, define user to database access grid.
Install via Apolo CLI
Step 1 — use CLI command to get application configuration file template:
apolo app-template get postgres -o mypostgres.yaml
Step 2 — fill in application parameters. Here is an example config file with some of those parameters:
Debrief of configuration parameters:
We enabled incremental and full backups via setting
input.backup.enable=true
.We configured PG Bouncer to have 1 replica and use
cpu-medium
resource preset in runtime.We created two users:
userone
andusertwo
. We also created two databases:dbone
,dbtwo
. Afterwards we granteduserone
access todbone
anddbtwo
DBs, whileusertwo
has access only todbtwo
. The users have write access level for those databases.We also setup PostgreSQL cluster to work in HA mode using Patroni and have 3 server replicas by setting
input.postgres_config.instance_replicas=3
. The resource preset for each instance is set to becpu-medium
viainputs.preset.name=cpu-medium
configuration parameter.The disk size under each replica is 10 Gigs.
The PostgreSQL server version is 16.
Step 3 — now you can install this application into your Apolo project:
apolo app install -f mypostgres.yaml
You could see the application status transitions via CLI:
If you want to see logs of the application, hit apolo app logs <app-id>
supplying the ID from a previous command output. Note: loading and displaying logs for your application might take some time.
Step 4 — if you want to remove the application via CLI, use apolo app remove <app-id>
.
You can find more information for application management commands in the list of references below.
Install via Apolo web console
Below is a brief description of how to deploy the PostgreSQL application with exactly the same configuration via Apolo web console.
Step 1 — find PostgreSQL application in list of apps, and click "install" button.
Step 2 — fill in the same parameters for this application
After setting up all input parameters, click "install" to start the installation. You will be redirected to an application details page, which displays application inputs, outputs and health status.
Your PostgreSQL cluster is ready. The application outputs, including access credentials are displayed below at this screen too. You could utilize this outputs with other applications or other workloads.
You could remove this application just like all other apps by clicking the "Uninstall" button in the upper right corner of the application details page.
Usage
After installing PostgreSQL cluster application, you could use it in all variations of workloads within the cluster, like jobs or other apps.
Currently, it is possible to connect to the database only from within the cluster workloads. Please, reach us if you need to expose the database to the outer world, we might help you find the solution.
While application interconnection in most of the cases is handled by the platform, you should know how to reach out database from your jobs.
In this small example, we'll use PostgreSQL container image as a client and connect to the database deployed previously.
Step 1 — start a client job via CLI
Pgbouncer Uri here is the output reported after the application being installed. Note, this output is only accessible to the participants of your project
Note: we advice selecting postgres image tag version matching the database version you deployed.
Step 2 — verify connection works, try creating minimal table
Step 3 — terminate job
And this is it!
Quick recap of what was done:
Deployed PostgreSQL cluster with backups, monitoring and configured RBAC
Verified configuration by connecting to the server from within Apolo Job and
Creating sample table
Inserting several records into the table
Querying the table
References
Last updated
Was this helpful?