Deleting a PostgreSQL Instance

WARNING

Important Considerations Before Deletion

  • This operation is irreversible - deleted instances cannot be recovered
  • Ensure you have valid backups if you might need the data later
  • Verify no applications are currently using this database instance
  • Cluster deletion will remove all replicas and associated resources

Deleting a PostgreSQL instance will remove:

  • The Custom Resource (CR)
  • StatefulSet and Pods
  • ConfigMaps and Secrets
  • PersistentVolumeClaims (PVCs)
  • Monitoring and logging resources

Procedure

CLI
Web Console

To delete a PostgreSQL instance (including all associated PVCs), execute:

kubectl -n $NAMESPACE delete postgresql <instance-name>

Example output:

postgresql.acid.zalan.do "example-postgres" deleted

After deletion, you can confirm the instance status with:

kubectl -n $NAMESPACE get postgresql

Post-Deletion Verification

After deletion, verify all resources are removed:

kubectl -n default get postgresql  # Should not show deleted instance
kubectl -n $NAMESPACE get pvc  # Verify PVCs were deleted