Kubernetes StatefulSetのPVCをリサイズする
データベースのデプロイなどで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>
記事をランダムに読む