https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets
There are some cases that you might be trying to update a statefulset and you get this error:
Error: cannot patch "my-statefulset" with kind StatefulSet: StatefulSet.apps "my-statefulset" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden && cannot patch "my-statefulset-tracking" with kind StatefulSet: StatefulSet.apps "my-statefulset-tracking" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden
And while you can diff a file manually beteween you update and the yaml that you can fecth: kubectl -n my-ns get sts my-statefulset -o yaml
So I makde the scritp that diff that also excluding the options, this will help you be faster on the system.
-> % k8s-diff-sts-upgrade.py template.yaml onserver.yaml
Differences in the 'spec' block:
- Field: revisionHistoryLimit
- template: None
- template: 10
- Field: serviceName
- template: my-statefulset-v1
- template: my-statefulset-v1-svc
- Field: podManagementPolicy
- template: None
- template: OrderedReady