kubectl patch statefulset updateStrategy RollingUpdate not patched

时间:2017-07-06 16:36:05

标签: kubernetes

我无法修补我的状态设置以使用RollingUpdate策略。

(在完成“StatefulSet基础知识”教程here)时遇到

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

我希望kubectl patch能够返回有关无法修补状态集的原因的更多信息。

kubectl edit告诉我......

  

找到v1beta1.StatefulSetSpec

的无效字段updateStrategy

但我不确定我是否将关键和价值放在适当的位置,以确保这是patch遇到的同一问题。

如何告诉我的statefulset使用RollingUpdate策略?

要重现此问题,请按照此处的Kubernetes教程进行操作:https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/

1 个答案:

答案 0 :(得分:0)

更好地将更改直接应用于yaml文件。

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