This guide describes the technical steps required to deploy PgCat using the pgcat/pgcat Helm chart on Kubernetes. It covers chart installation, configuration structure, authentication requirements, validation, and operational considerations. This guide is suitable for production environments and can support advanced use cases such as zero-downtime migrations and future read/write splitting.
PgCat is a PostgreSQL proxy and connection pooler supporting:
Connection pooling
SQL-aware routing
Read/write splitting
Sharding support
Mirroring (for migration or traffic shadowing)
This Helm chart converts a YAML configuration into PgCat's required TOML configuration format and injects it into the container. PgCat reads this TOML at startup.
Kubernetes cluster (any distribution)
Helm v3+
Access to the Helm repository:
https://postgresml.github.io/pgcat/PostgreSQL credentials for upstream cluster(s)
helm repo add pgcat https://postgresml.github.io/pgcat/
helm repo update
helm install pgcat pgcat/pgcat \
--namespace pgcat \
--create-namespace \
-f values.yaml
To update:
helm upgrade pgcat pgcat/pgcat -n pgcat -f values.yaml
To uninstall:
helm uninstall pgcat -n pgcat
This chart exposes configuration under the top-level key:
configuration:
This YAML is converted into PgCat's internal TOML configuration. PgCat does not accept YAML directly; the chart handles conversion.
Each pool must include:
name:pool namepool_mode:shards:listservers:inside shardsusers:list (mandatory)
If any of these are missing, PgCat will fail to parse TOML and the pod will crash-loop.
This example configures PgCat with one pool, primary + replica, and a required user.
configuration:
general:
enable_prometheus_exporter: true
prometheus_exporter_port: 9930
pools:
- name: main
pool_mode: transaction
shards:
- database: postgres
servers:
- host: my-primary-db.example.com
port: 5432
role: primary
- host: my-replica-db.example.com
port: 5432
role: replica
users:
- username: default
password: default
pool_size: 20
statement_timeout: 0
replicaCount: 2
The
users:block is mandatory; PgCat will not start without it.Passwords can be dummy values; PgCat authenticates to PostgreSQL using upstream credentials from the
serverssection.pool_mode: transactionis generally recommended for Kubernetes environments.
Applications connect to PgCat exactly as if it were PostgreSQL:
postgres://default:default@pgcat.pgcat.svc.cluster.local:6432/postgres
Where:
default:defaultmatches the user defined in values.yamlHost is the PgCat service
PgCat internally connects to PostgreSQL using the hosts defined under servers:.
Before deploying, inspect the generated TOML:
helm template pgcat pgcat/pgcat -f values.yaml | grep -A80 pgcat.toml
Ensure TOML contains:
[pools.<name>]table[[pools.<name>.shards.servers]]entries[[pools.<name>.users]]entries
If TOML is malformed, PgCat will log:
Could not parse config file: TOML parse error
This always indicates configuration structure issues.
PgCat is stateless; run ≥2 replicas for high availability.
Modify values.yaml and apply:
helm upgrade pgcat pgcat/pgcat -n pgcat -f values.yaml
PgCat restarts to pick up changes.
If PgCat crash-loops:
Check logs for TOML errors
Validate the
users:block existsCheck indentation in YAML
Ensure roles (
primary,replica) are valid
PgCat can act as a stable endpoint during database migration:
Point PgCat to PostgreSQL v11 (source).
Begin migration using pgcopydb + logical replication.
When ready, update PgCat
servers:to point to PostgreSQL v14.Apply Helm upgrade.
Applications reconnect automatically.
This enables near-zero downtime cutover.
Use
configuration:for YAML-based definitions; do not use rawpgcat.config.Always define at least one user under each pool.
Validate TOML output using
helm template.PgCat enables proxy-based migrations and future read/write splitting.
The Helm chart provides a predictable and maintainable deployment pattern.
This guide can be used as the PgCat deployment reference for all Kubernetes environments.