navanjr
navanjr

Reputation: 598

kubectl patch statefulset updateStrategy RollingUpdate NOT patched

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/

Upvotes: 2

Views: 2685

Answers (1)

Vinay Kumar Gupta
Vinay Kumar Gupta

Reputation: 162

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  

Upvotes: 1

Related Questions