If you’ve ever tried to resize a kubernetes statefulset PVC for a database deployment (or similar), you have probably seen this error
Internal server error
StatefulSet.apps “es-cluster” is invalid: spec: Forbidden: updates to statefulset > spec for fields other than ‘replicas’, ‘template’, and ‘updateStrategy’ are forbidden.
- Edit all the PVCs manually:
kubectl edit pvc -n <namespace> <name>
- Delete the StatefulSet, but leave the pods running:
kubectl delete -n <namesapce> statefulset --cascade=orphan <name>
- Recreate the StatefulSet with
helm upgrade
,kubectl apply
, or however else you deploy stuff - Restart the StatefulSet to redeploy all the pods
kubectl rollout restart statefulset -n namespace <name>