postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

Deploy a new cluster with the existing PVC

Open batulziiy opened this issue 7 months ago • 2 comments

Hi,

I just wonder if a new cluster can be created with the existing PVC, though couldn't find any information about this. The reason why I want to use the existing PVC is :

  • After trying to upgrade pgo version from 5.2 to 5.7, the cluster couldn't work properly and keep restarts without any visible clue. Now with the pgo reconciliation paused, cluster works stable.
  • Wanted to see if I can restore the PVC from existing pg deployment via Kasten (backup tool), then restore it to a new namespace where the new pg cluster is deployed. If the new cluster is able to work with the restored PVC, voila.
  • Since, the pg is running with cluster reconciliation paused, I'm not able to manage it via operator and when I resume the cluster reconciliation, the cluster itself fails to start.

Thanks in advance for your help.

batulziiy avatar May 19 '25 14:05 batulziiy

Hi, thanks for the detailed context.

In my opinion, the safest and most straightforward approach is to create a new standby PostgresCluster using the updated operator, and then switchover to it. This avoids the risks associated with directly reusing PVCs across clusters, especially in the middle of an operator upgrade issue.

While it's technically possible to reuse existing PVs to create PVCs for a new cluster, this requires fully stopping the current PostgreSQL instance and carefully decoupling the old PVCs. This process is fragile and risky especially if the cluster is already in a degraded state.

akinkara avatar May 28 '25 13:05 akinkara

hi, I really appreciate your help. Sounds like your approach is way more safer and reliable. Since we still have the PGO in a degraded state, I would opt for the most safe approach. For the record, I will update here what happened.

batulziiy avatar May 28 '25 14:05 batulziiy