Database Access

Connect to bundled PostgreSQL for debugging and backups.

Direct database access is useful for debugging, backups, and inspecting state. Avoid running ad-hoc queries in production.

Bundled PostgreSQL credentials

FieldValue
Usernamevault
Passwordvault
Databasevault
Port5432
Service namedev-sdk-postgresql

Connecting via port-forward

bash · terminal
1kubectl port-forward svc/dev-sdk-postgresql 5432:5432
2# Custom namespace:
3kubectl port-forward svc/dev-sdk-postgresql 5432:5432 -n <namespace>
4# Connect client to localhost:5432 with vault/vault

Retrieving a customized password

bash · terminal
1# Default namespace:
2kubectl get secret dev-sdk-postgresql -o jsonpath='{.data.password}' | base64 -d
3
4# Custom namespace:
5kubectl get secret dev-sdk-postgresql -n <namespace> -o jsonpath='{.data.password}' | base64 -d

Backup and restore

bash · terminal
1kubectl exec dev-sdk-postgresql-0 -- pg_dump -U vault -d vault > backup.sql
2kubectl exec -i dev-sdk-postgresql-0 -- psql -U vault -d vault < backup.sql

Was this page helpful?