Skip to content

Commit 2737f43

Browse files
committed
feat: add pgAdmin backup alternative to PostgreSQL migration guide
- Add Step 2b with pgAdmin GUI-based backup as alternative to pg_dumpall - Update prerequisites to clarify kubectl exec requirement and note pgAdmin option - Update overview to mention both backup methods - Addresses accessibility for ArgoCD-managed environments without direct kubectl exec access
1 parent 0bbce13 commit 2737f43

1 file changed

Lines changed: 82 additions & 2 deletions

File tree

migration-guides/GENERIC_POSTGRESQL_MIGRATION_GUIDE.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This guide provides a generic, reusable procedure for migrating PostgreSQL deplo
1212

1313
### What This Guide Covers
1414

15-
- Full database backup using `pg_dumpall`
15+
- Full database backup using `pg_dumpall` (CLI) or pgAdmin (GUI alternative)
1616
- Safe uninstallation of Bitnami PostgreSQL
1717
- Installation of CloudPirates PostgreSQL
1818
- Data restoration with integrity verification
@@ -31,12 +31,14 @@ This guide provides a generic, reusable procedure for migrating PostgreSQL deplo
3131

3232
## Prerequisites
3333

34-
- Kubernetes cluster access with `kubectl`
34+
- Kubernetes cluster access with `kubectl` (the `pg_dumpall` method in Step 2 requires `kubectl exec` / RBAC `pods/exec` permissions)
3535
- Helm 3.x installed
3636
- Maintenance window scheduled
3737
- Sufficient local disk space for database backup (2-3x database size recommended)
3838
- Access to modify Helm chart files (Chart.yaml, values.yaml)
3939

40+
> 💡 **No `kubectl exec` access?** If your environment is managed exclusively through ArgoCD or you lack direct cluster shell access, use the [pgAdmin alternative (Step 2b)](#step-2b-alternative-backup-database-using-pgadmin) instead of `pg_dumpall`.
41+
4042
---
4143

4244
## Configuration Variables
@@ -126,6 +128,84 @@ ls -lh ${BACKUP_FILE}
126128

127129
---
128130

131+
### Step 2b (Alternative): Backup Database Using pgAdmin
132+
133+
If you do not have `kubectl exec` access (e.g., environments managed exclusively via ArgoCD), you can use **pgAdmin** to create the backup through a web UI instead.
134+
135+
> 💡 **Tip**: If your Helm chart already deploys pgAdmin as a subchart (e.g., `pgadmin4.enabled: true`), you can use that instance directly — it already has network access to the PostgreSQL service within the cluster.
136+
>
137+
> Example subchart configuration:
138+
> ```yaml
139+
> pgadmin4:
140+
> enabled: true
141+
> env:
142+
> email: admin@example.com
143+
> password: admin-password
144+
> ingress:
145+
> enabled: true
146+
> hosts:
147+
> - host: pgadmin.example.com
148+
> paths:
149+
> - path: /
150+
> pathType: Prefix
151+
> ```
152+
153+
**Option A — pgAdmin runs inside the same cluster (recommended):**
154+
155+
Since pgAdmin can resolve Kubernetes service names directly, no port-forward is needed:
156+
157+
| Field | Value |
158+
|-------|-------|
159+
| **Host name/address** | `<release-name>-postgresql` (Kubernetes service name) |
160+
| **Port** | `5432` |
161+
| **Maintenance database** | your database name (e.g., `PG_DATABASE`) |
162+
| **Username** | your PostgreSQL admin user (e.g., `postgres`) |
163+
| **Password** | *(retrieve from your Kubernetes secret, see below)* |
164+
165+
**Option B — pgAdmin runs outside the cluster:**
166+
167+
Create a port-forward first, then connect to `localhost`:
168+
169+
```bash
170+
kubectl port-forward svc/<release-name>-postgresql 5432:5432 -n <namespace> &
171+
```
172+
173+
| Field | Value |
174+
|-------|-------|
175+
| **Host name/address** | `localhost` |
176+
| **Port** | `5432` |
177+
| **Maintenance database** | your database name (e.g., `PG_DATABASE`) |
178+
| **Username** | your PostgreSQL admin user (e.g., `postgres`) |
179+
| **Password** | *(retrieve from your Kubernetes secret, see below)* |
180+
181+
To retrieve the database password from your Kubernetes secret:
182+
```bash
183+
kubectl get secret <your-db-secret> -n <namespace> -o jsonpath='{.data.<password-key>}' | base64 -d
184+
```
185+
186+
**Register the server and create the backup:**
187+
188+
1. Open pgAdmin and log in
189+
2. Right-click **Servers** → **Register** → **Server...**
190+
3. In the **General** tab, set a name (e.g., `Migration PostgreSQL`)
191+
4. In the **Connection** tab, fill in the values from the table above
192+
5. Click **Save**
193+
6. In the browser tree, expand **Servers → Migration PostgreSQL → Databases**
194+
7. Right-click your database → **Backup...**
195+
8. Configure the backup:
196+
- **Filename**: `postgresql_backup` (pgAdmin will add the extension)
197+
- **Format**: `Custom` (recommended, supports selective restore) or `Plain` (SQL text)
198+
- **Encoding**: `UTF8`
199+
9. *(Optional)* In the **Data/Objects** tab:
200+
- Enable **Include CREATE DATABASE statement** for a full restore option
201+
- Enable **Use Column Inserts** for maximum compatibility
202+
10. Click **Backup**
203+
11. Verify the backup completed successfully in the pgAdmin notifications panel (bell icon, bottom-right)
204+
205+
> ⚠️ **Note**: Unlike `pg_dumpall`, a pgAdmin single-database backup does **not** include roles or other databases. If you need to preserve roles and permissions, either use `pg_dumpall` (Step 2) or back up the global objects separately via pgAdmin's **Backup Server** option.
206+
207+
---
208+
129209
### Step 3: Validate Backup Integrity
130210
131211
```bash

0 commit comments

Comments
 (0)