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?

More than 5 years have passed since last update.

ショートな初投稿 KubernetesにVolumeの良いresizeする方法

Posted at

こんにちは初めまして!(日本では夜ですけど…)
raehik(レイク)です。
前には投稿を書こうとしましたが、結局スケールが広すぎて諦めました。(汗)
ですから、この投稿には簡単なKubernetesのvolume managementの役立つポイントを紹介したいと思います。

日本語は母語ではないですから、意味不明部分があったら私のせいにして下さい!☺

はじめに

Kubernetesのvolume management1はちょっとね。Kubernetesの他いい部分を比べたらそう思うになる。それでも、Kubernetesはずっと良くなってるの!という証拠を紹介したいと思います。(もう一年前のフィーチャーですけど…)

必要事

  • Kubernetes 1.11以上
  • volume expansion(Volumeのサイズを増やすこと)がサポートするprovider AWS (EBS), GCP (Persistent Disk), Azureなど
  • 今PVCを使用している

あと、VolumeのStorageClassはallowVolumeExpansion: trueが設定したことが必要です。volume expansionの可能providerは最初から設定したかもしれませんけど、私の場合は違うですからこれをkubectl applyで(AWS用)。

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: gp2-expand
parameters:
  type: gp2
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
allowVolumeExpansion: true

そしてこのgp2-expandStorageClassを使ってみて。

方法

  1. PVCのフィールドspec.resources.requests.storageを増やして
  2. VolumeをmountしているPodを削除して(そしてまた作成)
  3. PVCがサイズを増やしたことが見えるまでStep2を繰り返して

Step1をやると、PVCはFileSystemResizePendingの様子になる。ファイルシステムのサイズを変更するにはVolumeをmountしているPodを削除することが必要です。

Volumeのサイズを増やす変更だけは可能です。

関連ページ

  1. Volumeをリーサイズ、作成、削除することなど

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?