Update StatefulSet volumeClaimTemplates And Other Uneditable Sections¶
Get the latest YAML of the StatefulSet you want to update (e.g., change size of a volumeClaimTemplates entry).
Make the changes to the YAML file.
Run kubectl delete statefulset STATEFULSET_NAME --cascade=orphan
The important thing here is the --cascade=orphan flag, it stops the ControllerRevisions objects (+ the Pods) to not be deleted (no downtime).
Now just apply your StatefulSet YAML and if needed trigger a rolling update of the StatefulSet using the kubectl rollout restart statefulset STATEFULSET_NAME command.
Quickly trigger Rolling Update of Deployment, StatefulSet, DaemonSet, etc¶
Running kubectl replace/kubectl apply on an object which the command above was used on, will always trigger a rolling update again. This is due to the change to the annotations.
The Pods manifest assumes that you are allowed to run privileged Pods in your cluster. If you are using you may need to set a ServiceAccount which is allowed "all the things" (e.g. privileged, hostNetwork, and so on).
The node-role.kubernetes.io/ can take "anything" as a role. Meaning that node-role.kubernetes.io/my-cool-role (any value) will cause the kubectl get nodes output to display my-cool-role (and other such role labels) as the Node role.