[kubernetes]-StatefulSet设置滚动更新策略

忘是亡心i 2022-12-31 01:25 294阅读 0赞

StatefulSet设置滚动更新策略

  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: myapp
  5. spec:
  6. updateStrategy:
  7. type: RollingUpdate
  8. rollingUpdate:
  9. partition: 3
  10. serviceName: myapp-svc
  11. replicas: 2
  12. selector:
  13. matchLabels:
  14. app: myapp-pod
  15. template:
  16. metadata:
  17. labels:
  18. app: myapp-pod
  19. spec:
  20. containers:
  21. - name: myapp
  22. image: nginx:1.18
  23. ports:
  24. - containerPort: 80
  25. name: web

这里记一笔

通过 kubectl explain sts.spec.updateStrategy.rollingUpdate和 kubectl explain deployment.spec.strategy.rollingUpdate对比,发现sts只能制定pod数,deployment能使用百分比。

似乎sts在pod为1的时候设置个数会有问题,deployment设置百分比就不会。这个有待考证,只是看博客票到了一眼,没实际遇到过。

发表评论

表情:
评论列表 (有 0 条评论,294人围观)

还没有评论,来说两句吧...

相关阅读

    相关 缓存更新策略

    缓存的更新策略 一般来说,缓存有以下三种模式: Cache Aside 更新模式 :同时更新缓存和数据库 Read/Write Through 更新模式 :