File tree Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Expand file tree Collapse file tree 2 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ title : 特定のノード上でのみPodを実行する
3
+ content_type : task
4
+ weight : 30
5
+ ---
6
+ <!-- overview -->
7
+
8
+ このページでは、{{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}の一部として、特定の{{<glossary_tooltip term_id="node" text="ノード">}}上でのみ{{<glossary_tooltip term_id="pod" text="Pod">}}を実行する方法を説明します。
9
+
10
+ ## {{% heading "prerequisites" %}}
11
+
12
+ {{< include "task-tutorial-prereqs.md" >}}
13
+
14
+ ## 特定のノードでのみPodを実行する
15
+
16
+ {{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}を実行したいが、そのデーモンPodをローカルのソリッドステートドライブ(SSD)ストレージを備えたノードでのみ実行する必要があるとします。
17
+ 例えば、Podがノードにキャッシュサービスを提供し、低遅延のローカルストレージが利用可能な場合にのみキャッシュが有用である場合などです。
18
+
19
+ ### ステップ1: ノードにラベルを追加する
20
+
21
+ SSDを持つノードに` ssd=true ` というラベルを追加します。
22
+
23
+ ``` shell
24
+ kubectl label nodes example-node-1 example-node-2 ssd=true
25
+ ```
26
+
27
+ ### ステップ2: マニフェストを作成する
28
+
29
+ SSDのラベルが付けられた{{<glossary_tooltip term_id="node" text="ノード">}}上にのみデーモンPodを配置する{{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}を作成してみましょう。
30
+
31
+ 次に、` nodeSelector ` を使用して、DaemonSetが` ssd ` ラベルに` "true" ` が設定されたノード上でのみPodを実行するようにします。
32
+
33
+ {{% code_sample file="controllers/daemonset-label-selector.yaml" %}}
34
+
35
+ ### ステップ3: DaemonSetを作成する
36
+
37
+ ` kubectl create ` または` kubectl apply ` を使用してマニフェストからDaemonSetを作成します。
38
+
39
+ 別のノードに` ssd=true ` というラベルを付けてみましょう。
40
+
41
+ ``` shell
42
+ kubectl label nodes example-node-3 ssd=true
43
+ ```
44
+
45
+ ノードにラベルを付けると、それによってコントロールプレーン(正確にはDaemonSetコントローラー)がトリガーされ、そのノード上で新しいデーモンPodが実行されます。
46
+
47
+ ``` shell
48
+ kubectl get pods -o wide
49
+ ```
50
+ 出力は次のようになります:
51
+
52
+ ```
53
+ NAME READY STATUS RESTARTS AGE IP NODE
54
+ <daemonset-name><some-hash-01> 1/1 Running 0 13s ..... example-node-1
55
+ <daemonset-name><some-hash-02> 1/1 Running 0 13s ..... example-node-2
56
+ <daemonset-name><some-hash-03> 1/1 Running 0 5s ..... example-node-3
57
+ ```
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : DaemonSet
3
+ metadata :
4
+ name : ssd-driver
5
+ labels :
6
+ app : nginx
7
+ spec :
8
+ selector :
9
+ matchLabels :
10
+ app : ssd-driver-pod
11
+ template :
12
+ metadata :
13
+ labels :
14
+ app : ssd-driver-pod
15
+ spec :
16
+ nodeSelector :
17
+ ssd : " true"
18
+ containers :
19
+ - name : example-container
20
+ image : example-image
You can’t perform that action at this time.
0 commit comments