kubectl patch statefulset updateStrategy RollingUpdate NOT patched

7/6/2017

I am unable to patch my statefulset to use a RollingUpdate strategy.

(Encountered while working through the "StatefulSet Basics" tutorial here)

$ kubectl patch statefulset web -p '{"spec":{"strategy":{"type":"RollingUpdate"}}}' 
statefulset "web" not patched

I wish kubectl patch would return more info as to the reason the statefulset could not be patched.

kubectl edit tells me...

found invalid field updateStrategy for v1beta1.StatefulSetSpec

But I am not sure I put the key and value in the proper place to be sure this is the same issue patch is encountering.

How do tell my statefulset to use a RollingUpdate strategy?

To reproduce this issue just follow the Kubernetes tutorial here: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/

-- navanjr
kubernetes

1 Answer

8/27/2019

Better to apply changes on your yaml file directly.

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: nginx-sts
spec:
  serviceName: "nginx-headless"
  replicas: 3
  #podManagementPolicy: Parallel
  selector:
    matchLabels:
      run: nginx-sts-demo
  updateStrategy:
    rollingUpdate:
      partition: 0   #for full partition update            
    type: RollingUpdate  
-- Vinay Kumar Gupta
Source: StackOverflow