<p>I am trying to migrate the PostgreSQL database from a performance NAS service to a cheaper General NAS service. Now I want to created a new PV and PVC and make my kubernetes statefulset to binding to the new PVC. I tried to edit the PVC binding in statefulset but give me this error:</p>
<pre><code>The StatefulSet &quot;reddwarf-postgresql-postgresql&quot; is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden
</code></pre>
<p>So It is impossible to change the legacy statefulset to binding to a new PVC? I have to create a new statefulset and delete the legacy PostgreSQL statefulset? what is the most smooth way to migrate the statefulset storage? I have copied all data and file structure from the legacy performance NAS service to the new NAS service.</p>

Dolphin
<p>Most fields become immutable once deployed, you can only delete and re-deploy for immutable fields. But this is not necessary a bad thing for your case. You can leverage the fact that when you delete StatefulSet, the PVC/PC are not automatically deleted. So you can consider create new StatefulSet which back by new PVC/PV using your new storage, then you move backup data to these newly created volumes. Then you delete the StatefulSet and update it with command for your Postgresql to run. Finally you re-deploy your StatefulSet and it will reuse the populated PVC/PV.</p>
<p>Other common approach is write <code>initContainers</code> to check if your pod is fresh and populate the volume with backup data if needed. You need to make sure your restore script is idempotent in this case.</p>
