-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecreate-postgres.sh
More file actions
34 lines (26 loc) · 951 Bytes
/
Copy pathrecreate-postgres.sh
File metadata and controls
34 lines (26 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
NAMESPACE="tfvisualizer"
echo "=========================================="
echo "RECREATING POSTGRESQL WITH CORRECT PASSWORD"
echo "=========================================="
echo ""
echo "WARNING: This will delete all data in PostgreSQL!"
echo "Press Ctrl+C within 5 seconds to cancel..."
sleep 5
echo ""
echo "1. Deleting PostgreSQL StatefulSet..."
kubectl delete statefulset postgres -n $NAMESPACE --cascade=orphan
echo ""
echo "2. Deleting PostgreSQL Pod..."
kubectl delete pod postgres-0 -n $NAMESPACE
echo ""
echo "3. Deleting PostgreSQL PersistentVolumeClaim (this removes all data)..."
kubectl delete pvc postgres-storage-postgres-0 -n $NAMESPACE
echo ""
echo "4. Waiting 10 seconds for cleanup..."
sleep 10
echo ""
echo "5. Recreating PostgreSQL StatefulSet with correct password..."
echo " Run: terraform apply"
echo ""
echo "After terraform apply completes, the PostgreSQL will initialize with the correct password."