Translate tasks/administer-cluster/extended-resource-node into Japanese.

This commit is contained in:
TAKAHASHI Shuuji
2020-07-24 22:29:47 +09:00
parent beb0919676
commit 8fb223f4d5
@@ -1,45 +1,32 @@
--- ---
title: Advertise Extended Resources for a Node title: 拡張リソースをNodeにアドバタイズする
content_type: task content_type: task
--- ---
<!-- overview --> <!-- overview -->
This page shows how to specify extended resources for a Node. このページでは、Nodeに対して拡張リソースを指定する方法を説明します。拡張リソースを利用すると、Kubernetesにとって未知のノードレベルのリソースをクラスター管理者がアドバタイズできるようになります。
Extended resources allow cluster administrators to advertise node-level
resources that would otherwise be unknown to Kubernetes.
## {{% heading "prerequisites" %}} ## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
<!-- steps --> <!-- steps -->
## Get the names of your Nodes ## Nodeの名前を取得する
```shell ```shell
kubectl get nodes kubectl get nodes
``` ```
Choose one of your Nodes to use for this exercise. この練習で使いたいNodeを1つ選んでください。
## Advertise a new extended resource on one of your Nodes ## Nodeの1つで新しい拡張リソースをアドバタイズする
To advertise a new extended resource on a Node, send an HTTP PATCH request to Node上の新しい拡張リソースをアドバタイズするには、HTTPのPATCHリクエストをKubernetes APIサーバーに送ります。たとえば、Nodeの1つに4つのドングルが接続されているとします。以下に、4つのdongleリソースをNodeにアドバタイズするPATCHリクエストの例を示します。
the Kubernetes API server. For example, suppose one of your Nodes has four dongles
attached. Here's an example of a PATCH request that advertises four dongle resources
for your Node.
```shell ```shell
PATCH /api/v1/nodes/<your-node-name>/status HTTP/1.1 PATCH /api/v1/nodes/<選択したNodeの名前>/status HTTP/1.1
Accept: application/json Accept: application/json
Content-Type: application/json-patch+json Content-Type: application/json-patch+json
Host: k8s-master:8080 Host: k8s-master:8080
@@ -53,34 +40,28 @@ Host: k8s-master:8080
] ]
``` ```
Note that Kubernetes does not need to know what a dongle is or what a dongle is for. Kubernetesは、dongleとは何かも、dongleが何に利用できるのかを知る必要もないことに注意してください。上のPATCHリクエストは、ただNodeが4つのdongleと呼ばれるものを持っているとKubernetesに教えているだけです。
The preceding PATCH request just tells Kubernetes that your Node has four things that
you call dongles.
Start a proxy, so that you can easily send requests to the Kubernetes API server: Kubernetes APIサーバーに簡単にリクエストを送れるように、プロキシーを実行します。
```shell ```shell
kubectl proxy kubectl proxy
``` ```
In another command window, send the HTTP PATCH request. もう1つのコマンドウィンドウを開き、HTTPPATCHリクエストを送ります。`<選択したNodeの名前>`の部分は、選択したNodeの名前に置き換えてください。
Replace `<your-node-name>` with the name of your Node:
```shell ```shell
curl --header "Content-Type: application/json-patch+json" \ curl --header "Content-Type: application/json-patch+json" \
--request PATCH \ --request PATCH \
--data '[{"op": "add", "path": "/status/capacity/example.com~1dongle", "value": "4"}]' \ --data '[{"op": "add", "path": "/status/capacity/example.com~1dongle", "value": "4"}]' \
http://localhost:8001/api/v1/nodes/<your-node-name>/status http://localhost:8001/api/v1/nodes/<選択したNodeの名前>/status
``` ```
{{< note >}} {{< note >}}
In the preceding request, `~1` is the encoding for the character / in 上のリクエストにある`~1`は、PATCHのパスにおける`/`という文字をエンコーディングしたものです。JSON-Patch内のoperationのpathはJSON-Pointerとして解釈されます。詳細については、[IETF RFC 6901](https://tools.ietf.org/html/rfc6901)のsection 3を読んでください。
the patch path. The operation path value in JSON-Patch is interpreted as a
JSON-Pointer. For more details, see
[IETF RFC 6901](https://tools.ietf.org/html/rfc6901), section 3.
{{< /note >}} {{< /note >}}
The output shows that the Node has a capacity of 4 dongles: 出力には、Nodeがキャパシティー4のdongleを持っていることが示されます。
``` ```
"capacity": { "capacity": {
@@ -89,13 +70,13 @@ The output shows that the Node has a capacity of 4 dongles:
"example.com/dongle": "4", "example.com/dongle": "4",
``` ```
Describe your Node: Nodeの説明を確認します。
``` ```
kubectl describe node <your-node-name> kubectl describe node <選択したNodeの名前>
``` ```
Once again, the output shows the dongle resource: 出力には、再びdongleリソースが表示されます。
```yaml ```yaml
Capacity: Capacity:
@@ -104,31 +85,17 @@ Capacity:
example.com/dongle: 4 example.com/dongle: 4
``` ```
Now, application developers can create Pods that request a certain これで、アプリケーション開発者は特定の数のdongleをリクエストするPodを作成できるようになりました。詳しくは、[拡張リソースをコンテナに割り当てる](/docs/tasks/configure-pod-container/extended-resource/)を読んでください。
number of dongles. See
[Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/).
## Discussion ## 議論
Extended resources are similar to memory and CPU resources. For example, 拡張リソースは、メモリやCPUリソースと同様のものです。たとえば、Nodeが持っている特定の量のメモリやCPUがNode上で動作している他のすべてのコンポーネントと共有されるのと同様に、Nodeが搭載している特定の数のdongleが他のすべてのコンポーネントと共有されます。そして、アプリケーション開発者が特定の量のメモリとCPUをリクエストするPodを作成できるのと同様に、Nodeが搭載している特定の数のdongleをリクエストするPodが作成できます。
just as a Node has a certain amount of memory and CPU to be shared by all components
running on the Node, it can have a certain number of dongles to be shared
by all components running on the Node. And just as application developers
can create Pods that request a certain amount of memory and CPU, they can
create Pods that request a certain number of dongles.
Extended resources are opaque to Kubernetes; Kubernetes does not 拡張リソースはKubernetesには詳細を意図的に公開しないため、Kubernetesは拡張リソースの実体をまったく知りません。Kubernetesが知っているのは、Nodeが特定の数の拡張リソースを持っているということだけです。拡張リソースは整数値でアドバタイズしなければなりません。たとえば、Nodeは4つのdongleをアドバタイズできますが、4.5のdongleというのはアドバタイズできません。
know anything about what they are. Kubernetes knows only that a Node
has a certain number of them. Extended resources must be advertised in integer
amounts. For example, a Node can advertise four dongles, but not 4.5 dongles.
### Storage example ### Storageの例
Suppose a Node has 800 GiB of a special kind of disk storage. You could Nodeに800GiBの特殊なディスクストレージがあるとします。この特殊なストレージの名前、たとえばexample.com/special-storageという名前の拡張リソースが作れます。そして、そのなかの一定のサイズ、たとえば100GiBのチャンクをアドバタイズできます。この場合、Nodeはexample.com/special-storageという種類のキャパシティ8のリソースを持っているとアドバタイズします。
create a name for the special storage, say example.com/special-storage.
Then you could advertise it in chunks of a certain size, say 100 GiB. In that case,
your Node would advertise that it has eight resources of type
example.com/special-storage.
```yaml ```yaml
Capacity: Capacity:
@@ -136,9 +103,7 @@ Capacity:
example.com/special-storage: 8 example.com/special-storage: 8
``` ```
If you want to allow arbitrary requests for special storage, you 特殊なストレージに任意のサイズのリクエストを許可したい場合、特殊なストレージを1バイトのサイズのチャンクでアドバタイズできます。その場合、example.com/special-storageという種類の800Giのリソースとしてアドバタイズします。
could advertise special storage in chunks of size 1 byte. In that case, you would advertise
800Gi resources of type example.com/special-storage.
```yaml ```yaml
Capacity: Capacity:
@@ -146,14 +111,14 @@ Capacity:
example.com/special-storage: 800Gi example.com/special-storage: 800Gi
``` ```
Then a Container could request any number of bytes of special storage, up to 800Gi. すると、コンテナは好きなバイト数の特殊なストレージを最大800Giまでリクエストできるようになります。
## Clean up ## クリーンアップ
Here is a PATCH request that removes the dongle advertisement from a Node. 以下に、dongleのアドバタイズをNodeから削除するPATCHリクエストを示します。
``` ```
PATCH /api/v1/nodes/<your-node-name>/status HTTP/1.1 PATCH /api/v1/nodes/<選択したNodeの名前>/status HTTP/1.1
Accept: application/json Accept: application/json
Content-Type: application/json-patch+json Content-Type: application/json-patch+json
Host: k8s-master:8080 Host: k8s-master:8080
@@ -166,44 +131,39 @@ Host: k8s-master:8080
] ]
``` ```
Start a proxy, so that you can easily send requests to the Kubernetes API server: Kubernetes APIサーバーに簡単にリクエストを送れるように、プロキシーを実行します。
```shell ```shell
kubectl proxy kubectl proxy
``` ```
In another command window, send the HTTP PATCH request. もう1つのコマンドウィンドウで、HTTPPATCHリクエストを送ります。`<選択したNodeの名前>`の部分は、選択したNodeの名前に置き換えてください。
Replace `<your-node-name>` with the name of your Node:
```shell ```shell
curl --header "Content-Type: application/json-patch+json" \ curl --header "Content-Type: application/json-patch+json" \
--request PATCH \ --request PATCH \
--data '[{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \ --data '[{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \
http://localhost:8001/api/v1/nodes/<your-node-name>/status http://localhost:8001/api/v1/nodes/<選択したNodeの名前>/status
``` ```
Verify that the dongle advertisement has been removed: dongleのアドバタイズが削除されたことを検証します。
``` ```
kubectl describe node <your-node-name> | grep dongle kubectl describe node <選択したNodeの名前> | grep dongle
``` ```
(you should not see any output) (出力には何も表示されないはずです)
## {{% heading "whatsnext" %}} ## {{% heading "whatsnext" %}}
### アプリケーション開発者向け
### For application developers * [拡張リソースをコンテナに割り当てる](/ja/docs/tasks/configure-pod-container/extended-resource/)
* [Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/) ### クラスター管理者向け
### For cluster administrators * [Namespaceに対してメモリの最小値と最大値の制約を設定する](/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/)
* [Namespaceに対してCPUの最小値と最大値の制約を設定する](/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/)
* [Configure Minimum and Maximum Memory Constraints for a Namespace](/docs/tasks/administer-cluster/memory-constraint-namespace/)
* [Configure Minimum and Maximum CPU Constraints for a Namespace](/docs/tasks/administer-cluster/cpu-constraint-namespace/)