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 namevault-key-postgresql

Connecting via port-forward

bash · terminal
1kubectl port-forward svc/vault-key-postgresql 5432:5432
2# Custom namespace:
3kubectl port-forward svc/vault-key-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 vault-key-postgresql -o jsonpath='{.data.password}' | base64 -d
3
4# Custom namespace:
5kubectl get secret vault-key-postgresql -n <namespace> -o jsonpath='{.data.password}' | base64 -d

Backup and restore

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

Was this page helpful?