Quick Start¶
Get a PostgreSQL cluster running in minutes.
Create a Cluster¶
Create your first PostgreSQL cluster:
apiVersion: pgop.ruck.io/v1alpha1
kind: Cluster
metadata:
name: my-cluster
namespace: default
spec:
image: postgres:18
replicas: 1
port: 5432
storage:
size: 5Gi
Apply the manifest:
Check Cluster Status¶
Output:
Access Credentials¶
The operator automatically generates credentials for the superuser:
The secret contains:
| Key | Description |
|---|---|
username |
Superuser username (pgop_operator) |
password |
Superuser password |
host |
Service hostname |
port |
PostgreSQL port |
database |
Default database (postgres) |
Create a Role¶
Create an application user:
apiVersion: pgop.ruck.io/v1alpha1
kind: Role
metadata:
name: app-user
namespace: default
spec:
clusterRef:
name: my-cluster
login: true
connectionLimit: 10
The operator auto-generates credentials and stores them in a secret:
Create a Database¶
Create a database with extensions:
apiVersion: pgop.ruck.io/v1alpha1
kind: Database
metadata:
name: myapp
namespace: default
spec:
clusterRef:
name: my-cluster
owner: app-user
extensions:
- name: uuid-ossp
- name: pg_trgm
schemas:
- name: app
owner: app-user
Connect to PostgreSQL¶
Port-forward to access the database:
Connect using the credentials:
PGPASSWORD=$(kubectl get secret my-cluster-credentials -o jsonpath='{.data.password}' | base64 -d) \
psql -h localhost -U pgop_operator -d postgres