Interview Prep/Helm/Install & Upgrade Failures

`Error: UPGRADE FAILED: cannot patch "shop-postgres" with kind StatefulSet: StatefulSet.apps "shop-postgres" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden`

AdvancedTroubleshootingInstall & Upgrade Failures
Answer

Likely causes → The new chart changes volumeClaimTemplates, serviceName, selector or podManagementPolicy, which are immutable on StatefulSets.

Diagnose →

helm diff upgrade shop ./shop -n shop -f values-prod.yaml | grep -A20 'StatefulSet'

Fix → Revert the change, or recreate the StatefulSet without touching pods and PVCs:

kubectl delete sts shop-postgres -n shop --cascade=orphan
helm upgrade shop ./shop -n shop -f values-prod.yaml

For a storage size increase, resize the PVCs directly (if the StorageClass allows expansion) before recreating.

Prevent → CI check for StatefulSet immutable fields; document storage change procedures.

All Helm questions Roadmap: Helm

More on Install & Upgrade Failures