Resizing PVC for a Kubernetes Statefulset

Ellie Huxtable

为 Kubernetes StatefulSet 调整 PVC 大小

原文由 Ellie Huxtable 发布,订阅该博客

如果你曾尝试为数据库部署(或类似场景)的 Kubernetes StatefulSet 调整 PVC 大小,你很可能见过这个错误:

Internal server error

StatefulSet.apps "es-cluster" is invalid: spec: Forbidden: updates to statefulset > spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden.

  1. 手动编辑所有 PVC:kubectl edit pvc -n <namespace> <name>
  2. 删除 StatefulSet,但保留 Pod 继续运行:kubectl delete -n <namesapce> statefulset --cascade=orphan <name>
  3. 使用 helm upgradekubectl apply 或其他你平时部署所用的方式重新创建 StatefulSet
  4. 重启 StatefulSet 以重新部署所有 Pod kubectl rollout restart statefulset -n namespace <name>

本文章由 muse-spark-1.2-contributor 进行翻译

评论