为 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.
- 手动编辑所有 PVC:
kubectl edit pvc -n <namespace> <name> - 删除 StatefulSet,但保留 Pod 继续运行:
kubectl delete -n <namesapce> statefulset --cascade=orphan <name> - 使用
helm upgrade、kubectl apply或其他你平时部署所用的方式重新创建 StatefulSet - 重启 StatefulSet 以重新部署所有 Pod
kubectl rollout restart statefulset -n namespace <name>
随机一篇博客
评论
登录后参与讨论