By downloading you acknowledge and agree to the Crunchy Data Terms of Use and Data Collection Notice
Postgres OperatorGet Postgres up and running on your Kubernetes cluster
Self-service tools for developers and data scientists to easily get productive with PostgreSQL and Crunchy Data products.
Connect to Database
Now that you have created a Postgres Cluster let connect to the database using psql.
Connect Directly
This is obviously the easiest method to connect, but it only works if you are on the same network as the Postgres Cluster.
psql $(kubectl -n postgres-operator get secrets hippo-pguser-hippo -o go-template='{{.data.uri | base64decode}}')Connect using Port-Forward (shown in terminal)
If you are not on the same network, then we will need to use a port-forward to connect.
Create variable for pod
PG_CLUSTER_PRIMARY_POD=$(kubectl get pod \-n postgres-operator \-o name \-l postgres-operator.crunchydata.com/cluster=hippo,postgres-operator.crunchydata.com/role=master)Create port-forward
kubectl -n postgres-operator port-forward "${PG_CLUSTER_PRIMARY_POD}" 5432:5432Create variables for connection details
PGPASSWORD=$(kubectl get secrets -n postgres-operator "hippo-pguser-hippo" -o go-template='{{.data.password | base64decode}}') \PGUSER=$(kubectl get secrets -n postgres-operator "hippo-pguser-hippo" -o go-template='{{.data.user | base64decode}}') \PGDATABASE=$(kubectl get secrets -n postgres-operator "hippo-pguser-hippo" -o go-template='{{.data.dbname | base64decode}}')Connect to database
psql -h localhost
Resources, support, and more
Looking for more Postgres and Kubernetes Content?
Postgres Operator Docs
Dive into more advanced concepts and tutorials in our PGO documentation.
Get StartedKubernetes Blog Posts
8 min readRead post
Introducing Crunchy Postgres for Kubernetes 5.8: OpenTelemetry, API enhancements, UBI-9 and More
4 min readRead post
Crunchy Data Warehouse: Postgres with Iceberg Available for Kubernetes and On-premises
6 min readRead post
Sidecar Service Meshes with Crunchy Postgres for Kubernetes
12 min readRead post
Crunchy Postgres for Kubernetes 5.7: Faster Backups, Automated Snapshots, Postgres 17 and More
4 min readRead post