1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HelmでMinioがアップグレードできなくなった

Posted at

はじめに

しばらく前からMinioをHelmから導入していますが、このChartは公式のガイドからはなくなっているようです。

$ sudo helm repo list
NAME                            URL
minio                           https://charts.min.io/     

公式ガイドではOperatorが推されているようです。

どこかでOperatorに移行しないとなのかもしれませんが、とりあえず最新版にアップグレードしようと思います。

しかし作業を進めるとhelm upgradeがうまく動作しなくなってしまいました。最終的には下記のように成功していますが、しばらくはどうしてか良く分からずhelmのREVISION番号が増えていくままでした。

sudo helm -n minio history staging-minioの出力抜粋
2               Wed Jul 12 05:07:08 2023        superseded      minio-5.0.13    RELEASE.2023-07-07T07-13-57Z Upgrade complete
3               Fri Jun 21 05:12:41 2024        failed          minio-5.2.0     RELEASE.2024-04-18T19-09-19Z Upgrade "staging-minio" failed: cannot patch "staging-minio" with kind StatefulSet: StatefulSet.apps "staging-minio" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'ordinals', 'template', 'updateStrategy', 'persistentVolumeClaimRetentionPolicy' and 'minReadySeconds' are forbidden
...
9               Fri Jun 21 07:12:48 2024        deployed        minio-5.2.0     RELEASE.2024-04-18T19-09-19Z Upgrade complete   

原因

メッセージにあるとおりStatefulSetを利用している場合に、以下のフィールド以外の値が更新されているためエラーが発生しました。

  • 'replicas'
  • 'ordinals'
  • 'template'
  • 'updateStrategy'
  • 'persistentVolumeClaimRetentionPolicy'
  • 'minReadySeconds'

問題はどこが変更されているのか良く分からない点でした。

幸いgitでvalues.yamlファイルを管理していたので履歴を辿っていくと、手動でMinioのPVを拡張した時にvalues.yamlにも同様の変更を反映していました。

@@ -159,7 +162,7 @@ persistence:
   storageClass: "rook-ceph-block"
   volumeName: ""
   accessMode: ReadWriteOnce
-  size: 1024Gi
+  size: 10Gi
 
   ## If subPath is set mount a sub folder of a volume instead of the root of the volume.
   ## This is especially handy for volume plugins that don't natively support sub mounting (like glusterfs).

今回の問題自体はvalues.yamlの内容を管理していれば比較的簡単に解決できますが、helmは様々な利用例があるので場合によってはエラー時の原因追求が少し難しいかもしれません。

今回感じた問題点

例えばhelm get valuesを利用しても得られたものはエラーが発生したvalues.yamlの内容を反映したものでした。

helmの利用に慣れていれば説明なしに使いこなせるのかもしれませんが、戸惑った点です。

本来は--revisionを指定してdeployedステータスの値を取り出すべきでしたが、Minio公式ガイドをみてもそこまでの記述はありませんでした。

本来のアップグレード手順は、次のようなものでした。

本来のminioのアップグレード手順
$ helm get values my-release > old_values.yaml
## Then change the field image.tag in old_values.yaml file with MinIO image tag you want to use. Now update the chart using
$ helm upgrade -f old_values.yaml my-release minio/minio

次のような手順であれば問題なくアップグレードできたのだと思います。

$ sudo helm get values -n minio staging-minio --revision 2 > old_values.yaml
## Change the image: values for new minio charts
$ sudo helm upgrade -f old_values.yaml -n minio staging-minio minio/minio

将来的にminio内部の構造が変更されない限りはこの構成で問題ないとは思いますが、良くテストされているOperatorが使えるのであればそちらに移行するべきかもしれません。

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?