|
1 | 1 | ---
|
2 |
| -reviewers: |
3 |
| -- jsafrane |
4 |
| -- saad-ali |
5 |
| -- msau42 |
6 |
| -- xing-yang |
7 |
| -- pohly |
8 |
| -title: Storage Capacity |
| 2 | +title: ストレージ容量 |
9 | 3 | content_type: concept
|
10 | 4 | weight: 45
|
11 | 5 | ---
|
12 | 6 |
|
13 | 7 | <!-- overview -->
|
14 | 8 |
|
15 |
| -Storage capacity is limited and may vary depending on the node on |
16 |
| -which a pod runs: network-attached storage might not be accessible by |
17 |
| -all nodes, or storage is local to a node to begin with. |
| 9 | +ストレージ容量は、Podが実行されるノードごとに制限があったり、大きさが異なる可能性があります。たとえば、NASがすべてのノードからはアクセスできなかったり、初めはストレージがノードローカルでしか利用できない可能性があります。 |
18 | 10 |
|
19 | 11 | {{< feature-state for_k8s_version="v1.19" state="alpha" >}}
|
20 | 12 |
|
21 |
| -This page describes how Kubernetes keeps track of storage capacity and |
22 |
| -how the scheduler uses that information to schedule Pods onto nodes |
23 |
| -that have access to enough storage capacity for the remaining missing |
24 |
| -volumes. Without storage capacity tracking, the scheduler may choose a |
25 |
| -node that doesn't have enough capacity to provision a volume and |
26 |
| -multiple scheduling retries will be needed. |
| 13 | +このページでは、Kubernetesがストレージ容量を追跡し続ける方法と、スケジューラーがその情報を利用して、残りの未作成のボリュームのために十分なストレージ容量へアクセスできるノード上にどのようにPodをスケジューリングするかについて説明します。もしストレージ容量の追跡がなければ、スケジューラーは、ボリュームをプロビジョニングするために十分な容量のないノードを選択してしまい、スケジューリングの再試行が複数回行われてしまう恐れがあります。 |
27 | 14 |
|
28 |
| -Tracking storage capacity is supported for {{< glossary_tooltip |
29 |
| -text="Container Storage Interface" term_id="csi" >}} (CSI) drivers and |
30 |
| -[needs to be enabled](#enabling-storage-capacity-tracking) when installing a CSI driver. |
| 15 | +ストレージ容量の追跡は、{{< glossary_tooltip text="Container Storage Interface" term_id="csi" >}}(CSI)向けにサポートされており、CSIドライバーのインストール時に[有効にする必要があります](#enabling-storage-capacity-tracking)。 |
31 | 16 |
|
32 | 17 | <!-- body -->
|
33 | 18 |
|
34 | 19 | ## API
|
35 | 20 |
|
36 |
| -There are two API extensions for this feature: |
37 |
| -- [CSIStorageCapacity](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csistoragecapacity-v1alpha1-storage-k8s-io) objects: |
38 |
| - these get produced by a CSI driver in the namespace |
39 |
| - where the driver is installed. Each object contains capacity |
40 |
| - information for one storage class and defines which nodes have |
41 |
| - access to that storage. |
42 |
| -- [The `CSIDriverSpec.StorageCapacity` field](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csidriverspec-v1-storage-k8s-io): |
43 |
| - when set to `true`, the Kubernetes scheduler will consider storage |
44 |
| - capacity for volumes that use the CSI driver. |
45 |
| - |
46 |
| -## Scheduling |
47 |
| - |
48 |
| -Storage capacity information is used by the Kubernetes scheduler if: |
49 |
| -- the `CSIStorageCapacity` feature gate is true, |
50 |
| -- a Pod uses a volume that has not been created yet, |
51 |
| -- that volume uses a {{< glossary_tooltip text="StorageClass" term_id="storage-class" >}} which references a CSI driver and |
52 |
| - uses `WaitForFirstConsumer` [volume binding |
53 |
| - mode](/docs/concepts/storage/storage-classes/#volume-binding-mode), |
54 |
| - and |
55 |
| -- the `CSIDriver` object for the driver has `StorageCapacity` set to |
56 |
| - true. |
57 |
| - |
58 |
| -In that case, the scheduler only considers nodes for the Pod which |
59 |
| -have enough storage available to them. This check is very |
60 |
| -simplistic and only compares the size of the volume against the |
61 |
| -capacity listed in `CSIStorageCapacity` objects with a topology that |
62 |
| -includes the node. |
63 |
| - |
64 |
| -For volumes with `Immediate` volume binding mode, the storage driver |
65 |
| -decides where to create the volume, independently of Pods that will |
66 |
| -use the volume. The scheduler then schedules Pods onto nodes where the |
67 |
| -volume is available after the volume has been created. |
68 |
| - |
69 |
| -For [CSI ephemeral volumes](/docs/concepts/storage/volumes/#csi), |
70 |
| -scheduling always happens without considering storage capacity. This |
71 |
| -is based on the assumption that this volume type is only used by |
72 |
| -special CSI drivers which are local to a node and do not need |
73 |
| -significant resources there. |
74 |
| - |
75 |
| -## Rescheduling |
76 |
| - |
77 |
| -When a node has been selected for a Pod with `WaitForFirstConsumer` |
78 |
| -volumes, that decision is still tentative. The next step is that the |
79 |
| -CSI storage driver gets asked to create the volume with a hint that the |
80 |
| -volume is supposed to be available on the selected node. |
81 |
| - |
82 |
| -Because Kubernetes might have chosen a node based on out-dated |
83 |
| -capacity information, it is possible that the volume cannot really be |
84 |
| -created. The node selection is then reset and the Kubernetes scheduler |
85 |
| -tries again to find a node for the Pod. |
86 |
| - |
87 |
| -## Limitations |
88 |
| - |
89 |
| -Storage capacity tracking increases the chance that scheduling works |
90 |
| -on the first try, but cannot guarantee this because the scheduler has |
91 |
| -to decide based on potentially out-dated information. Usually, the |
92 |
| -same retry mechanism as for scheduling without any storage capacity |
93 |
| -information handles scheduling failures. |
94 |
| - |
95 |
| -One situation where scheduling can fail permanently is when a Pod uses |
96 |
| -multiple volumes: one volume might have been created already in a |
97 |
| -topology segment which then does not have enough capacity left for |
98 |
| -another volume. Manual intervention is necessary to recover from this, |
99 |
| -for example by increasing capacity or deleting the volume that was |
100 |
| -already created. [Further |
101 |
| -work](https://github.com/kubernetes/enhancements/pull/1703) is needed |
102 |
| -to handle this automatically. |
103 |
| - |
104 |
| -## Enabling storage capacity tracking |
105 |
| - |
106 |
| -Storage capacity tracking is an *alpha feature* and only enabled when |
107 |
| -the `CSIStorageCapacity` [feature |
108 |
| -gate](/docs/reference/command-line-tools-reference/feature-gates/) and |
109 |
| -the `storage.k8s.io/v1alpha1` {{< glossary_tooltip text="API group" term_id="api-group" >}} are enabled. For details on |
110 |
| -that, see the `--feature-gates` and `--runtime-config` [kube-apiserver |
111 |
| -parameters](/docs/reference/command-line-tools-reference/kube-apiserver/). |
112 |
| - |
113 |
| -A quick check |
114 |
| -whether a Kubernetes cluster supports the feature is to list |
115 |
| -CSIStorageCapacity objects with: |
| 21 | +この機能には、以下の2つのAPI拡張があります。 |
| 22 | + |
| 23 | +- [CSIStorageCapacity](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csistoragecapacity-v1alpha1-storage-k8s-io)オブジェクト: このオブジェクトは、CSIドライバーがインストールされた名前空間に生成されます。各オブジェクトには1つのストレージクラスに対する容量の情報が含まれ、そのストレージに対してどのノードがアクセス権を持つかが定められています。 |
| 24 | + |
| 25 | +- [`CSIDriverSpec.StorageCapacity`フィールド](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#csidriverspec-v1-storage-k8s-io): `true`に設定すると、Kubernetesのスケジューラーが、CSIドライバーを使用するボリュームに対してストレージ容量を考慮するようになります。 |
| 26 | + |
| 27 | +## スケジューリング |
| 28 | + |
| 29 | +ストレージ容量の情報がKubernetesのスケジューラーで利用されるのは、以下のすべての条件を満たす場合です。 |
| 30 | + |
| 31 | +- `CSIStorageCapacity`フィーチャーゲートがtrueである |
| 32 | +- Podがまだ作成されていないボリュームを使用している |
| 33 | +- そのボリュームが、CSIドライバーを参照し、[volume binding mode](/docs/concepts/storage/storage-classes/#volume-binding-mode)に`WaitForFirstConsumer`を使う{{< glossary_tooltip text="StorageClass" term_id="storage-class" >}}を使用している |
| 34 | + |
| 35 | +その場合、スケジューラーはPodに対して、十分なストレージが利用できるノードだけを考慮するようになります。このチェックは非常に単純で、ボリュームのサイズと、`CSIStorageCapacity`オブジェクトに一覧された容量を、ノードを含むトポロジで比較するだけです。 |
| 36 | + |
| 37 | +volume binding modeが`Immediate`のボリュームの場合、ボリュームを使用するPodとは独立に、ストレージドライバーがボリュームの作成場所を決定します。次に、スケジューラーはボリュームが作成された後、Podをボリュームが利用できるノードにスケジューリングします。 |
| 38 | + |
| 39 | +[CSI ephemeral volumes](/docs/concepts/storage/volumes/#csi)の場合、スケジューリングは常にストレージ容量を考慮せずに行われます。このような動作になっているのは、このボリュームタイプはノードローカルな特別なCSIドライバーでのみ使用され、そこでは特に大きなリソースが必要になることはない、という想定に基づいています。 |
| 40 | + |
| 41 | +## 再スケジューリング |
| 42 | + |
| 43 | +`WaitForFirstConsumer`ボリュームがあるPodに対してノードが選択された場合は、その決定はまだ一時的なものです。次のステップで、CSIストレージドライバーに対して、選択されたノード上でボリュームが利用可能になることが予定されているというヒントを付きでボリュームの作成を要求します。 |
| 44 | + |
| 45 | +Kubernetesは古い容量の情報をもとにノードを選択する場合があるため、実際にはボリュームが作成できないという可能性が存在します。その場合、ノードの選択がリセットされ、KubernetesスケジューラーはPodに割り当てるノードを再び探します。 |
| 46 | + |
| 47 | +## 制限 |
| 48 | + |
| 49 | +ストレージ容量を追跡することで、1回目の試行でスケジューリングが成功する可能性が高くなります。しかし、スケジューラーは潜在的に古い情報に基づいて決定を行う可能性があるため、成功を保証することはできません。通常、ストレージ容量の情報が存在しないスケジューリングと同様のリトライの仕組みによって、スケジューリングの失敗に対処します。 |
| 50 | + |
| 51 | +スケジューリングが永続的に失敗する状況の1つは、Podが複数のボリュームを使用する場合で、あるトポロジーのセグメントで1つのボリュームがすでに作成された後、もう1つのボリュームのために十分な容量が残っていないような場合です。この状況から回復するには、たとえば、容量を増加させたり、すでに作成されたボリュームを削除するなどの手動の仲介が必要です。この問題に自動的に対処するためには、まだ[追加の作業](https://github.com/kubernetes/enhancements/pull/1703)が必要となっています。 |
| 52 | + |
| 53 | +## ストレージ容量の追跡を有効にする {#enabling-storage-capacity-tracking} |
| 54 | + |
| 55 | +ストレージ容量の追跡は*アルファ機能*であり、`CSIStorageCapacity`[フィーチャーゲート](/ja/docs/reference/command-line-tools-reference/feature-gates/)と`storage.k8s.io/v1alpha1` {{< glossary_tooltip text="API group" term_id="api-group" >}}を有効にした場合にのみ、有効化されます。詳細については、`--feature-gates`および`--runtime-config` [kube-apiserverパラメータ](/docs/reference/command-line-tools-reference/kube-apiserver/)を参照してください。 |
| 56 | + |
| 57 | +Kubernetesクラスターがこの機能をサポートしているか簡単に確認するには、以下のコマンドを実行して、CSIStorageCapacityオブジェクトを一覧表示します。 |
| 58 | + |
116 | 59 | ```shell
|
117 | 60 | kubectl get csistoragecapacities --all-namespaces
|
118 | 61 | ```
|
119 | 62 |
|
120 |
| -If your cluster supports CSIStorageCapacity, the response is either a list of CSIStorageCapacity objects or: |
| 63 | +クラスターがCSIStorageCapacityをサポートしていれば、CSIStorageCapacityのリストが表示されるか、次のメッセージが表示されます。 |
121 | 64 | ```
|
122 | 65 | No resources found
|
123 | 66 | ```
|
124 | 67 |
|
125 |
| -If not supported, this error is printed instead: |
| 68 | +もしサポートされていなければ、代わりに次のエラーが表示されます。 |
| 69 | + |
126 | 70 | ```
|
127 | 71 | error: the server doesn't have a resource type "csistoragecapacities"
|
128 | 72 | ```
|
129 | 73 |
|
130 |
| -In addition to enabling the feature in the cluster, a CSI |
131 |
| -driver also has to |
132 |
| -support it. Please refer to the driver's documentation for |
133 |
| -details. |
| 74 | +クラスター内で機能を有効化することに加えて、CSIドライバーもこの機能をサポートしている必要があります。詳細については、各ドライバーのドキュメントを参照してください。 |
134 | 75 |
|
135 | 76 | ## {{% heading "whatsnext" %}}
|
136 | 77 |
|
137 |
| - - For more information on the design, see the |
138 |
| -[Storage Capacity Constraints for Pod Scheduling KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/1472-storage-capacity-tracking/README.md). |
139 |
| -- For more information on further development of this feature, see the [enhancement tracking issue #1472](https://github.com/kubernetes/enhancements/issues/1472). |
140 |
| -- Learn about [Kubernetes Scheduler](/docs/concepts/scheduling-eviction/kube-scheduler/) |
| 78 | + - 設計に関するさらなる情報について知るために、[Storage Capacity Constraints for Pod Scheduling KEP](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/1472-storage-capacity-tracking/README.md)を読む。 |
| 79 | +- この機能の今後の開発に関する情報について知るために、[enhancement tracking issue #1472](https://github.com/kubernetes/enhancements/issues/1472)を参照する。 |
| 80 | +- [Kubernetesのスケジューラー](/ja/docs/concepts/scheduling-eviction/kube-scheduler/)についてもっと学ぶ。 |
0 commit comments