1
1
---
2
- title : Assign Pods to Nodes using Node Affinity
2
+ title : Node Affinityを利用してPodをノードに割り当てる
3
3
min-kubernetes-server-version : v1.10
4
4
content_type : task
5
5
weight : 120
6
6
---
7
7
8
8
<!-- overview -->
9
- This page shows how to assign a Kubernetes Pod to a particular node using Node Affinity in a
10
- Kubernetes cluster.
9
+ このページでは、Node Affinityを利用して、PodをKubernetesクラスター内の特定のノードに割り当てる方法を説明します。
11
10
12
11
13
12
## {{% heading "prerequisites" %}}
@@ -19,35 +18,37 @@ Kubernetes cluster.
19
18
20
19
<!-- steps -->
21
20
22
- ## Add a label to a node
21
+ ## ノードにラベルを追加する
23
22
24
- 1 . List the nodes in your cluster, along with their labels:
23
+ 1 . クラスター内のノードを一覧表示して、ラベルを確認します。
25
24
26
25
``` shell
27
26
kubectl get nodes --show-labels
28
27
```
29
- The output is similar to this:
28
+
29
+ 出力は次のようになります。
30
30
31
31
` ` ` shell
32
32
NAME STATUS ROLES AGE VERSION LABELS
33
33
worker0 Ready < none> 1d v1.13.0 ...,kubernetes.io/hostname=worker0
34
34
worker1 Ready < none> 1d v1.13.0 ...,kubernetes.io/hostname=worker1
35
35
worker2 Ready < none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2
36
36
` ` `
37
- 1. Chose one of your nodes, and add a label to it:
37
+ 1. ノードを選択して、ラベルを追加します。
38
38
39
39
` ` ` shell
40
40
kubectl label nodes < your-node-name> disktype=ssd
41
41
` ` `
42
- where ` < your-node-name> ` is the name of your chosen node.
43
42
44
- 1. Verify that your chosen node has a ` disktype=ssd` label:
43
+ ここで、` < your-node-name> ` は選択したノードの名前で置換します。
44
+
45
+ 1. 選択したノードに` disktype=ssd` ラベルがあることを確認します。
45
46
46
47
` ` ` shell
47
48
kubectl get nodes --show-labels
48
49
` ` `
49
50
50
- The output is similar to this:
51
+ 出力は次のようになります。
51
52
52
53
```
53
54
NAME STATUS ROLES AGE VERSION LABELS
@@ -56,67 +57,59 @@ Kubernetes cluster.
56
57
worker2 Ready < none> 1d v1.13.0 ...,kubernetes.io/hostname=worker2
57
58
```
58
59
59
- In the preceding output, you can see that the ` worker0` node has a
60
- ` disktype=ssd` label.
60
+ この出力を見ると、` worker0` ノードに` disktype=ssd` というラベルが追加されたことがわかります。
61
61
62
- # # Schedule a Pod using required node affinity
62
+ # # required node affinityを使用してPodをスケジューリングする
63
63
64
- This manifest describes a Pod that has a ` requiredDuringSchedulingIgnoredDuringExecution` node affinity,` disktype: ssd` .
65
- This means that the pod will get scheduled only on a node that has a ` disktype=ssd` label.
64
+ 以下に示すマニフェストには、` requiredDuringSchedulingIgnoredDuringExecution` に` disktype: ssd` というnode affinityを使用したPodが書かれています。このように書くと、Podは` disktype=ssd` というラベルを持つノードにだけスケジューリングされるようになります。
66
65
67
66
{{< codenew file=" pods/pod-nginx-required-affinity.yaml" > }}
68
67
69
- 1. Apply the manifest to create a Pod that is scheduled onto your
70
- chosen node:
68
+ 1. マニフェストを適用して、選択したノード上にスケジューリングされるPodを作成します。
71
69
72
70
` ` ` shell
73
71
kubectl apply -f https://k8s.io/examples/pods/pod-nginx-required-affinity.yaml
74
72
` ` `
75
73
76
- 1. Verify that the pod is running on your chosen node:
74
+ 1. Podが選択したノード上で実行されていることを確認します。
77
75
78
76
` ` ` shell
79
77
kubectl get pods --output=wide
80
78
` ` `
81
79
82
- The output is similar to this:
80
+ 出力は次のようになります。
83
81
84
82
```
85
83
NAME READY STATUS RESTARTS AGE IP NODE
86
84
nginx 1/1 Running 0 13s 10.200.0.4 worker0
87
85
```
88
86
89
- # # Schedule a Pod using preferred node affinity
87
+ # # preferred node affinityを使用してPodをスケジューリングする
90
88
91
- This manifest describes a Pod that has a ` preferredDuringSchedulingIgnoredDuringExecution` node affinity,` disktype: ssd` .
92
- This means that the pod will prefer a node that has a ` disktype=ssd` label.
89
+ 以下に示すマニフェストには、` preferredDuringSchedulingIgnoredDuringExecution` に` disktype: ssd` というnode affinityを使用したPodが書かれています。このように書くと、Podは` disktype=ssd` というラベルを持つノードに優先的にスケジューリングされるようになります。
93
90
94
91
{{< codenew file=" pods/pod-nginx-preferred-affinity.yaml" > }}
95
92
96
- 1. Apply the manifest to create a Pod that is scheduled onto your
97
- chosen node:
93
+ 1. マニフェストを適用して、選択したノード上にスケジューリングされるPodを作成します。
98
94
99
95
` ` ` shell
100
96
kubectl apply -f https://k8s.io/examples/pods/pod-nginx-preferred-affinity.yaml
101
97
` ` `
102
98
103
- 1. Verify that the pod is running on your chosen node:
99
+ 1. Podが選択したノード上で実行されていることを確認します。
104
100
105
101
` ` ` shell
106
102
kubectl get pods --output=wide
107
103
` ` `
108
104
109
- The output is similar to this:
105
+ 出力は次のようになります。
110
106
111
107
```
112
108
NAME READY STATUS RESTARTS AGE IP NODE
113
109
nginx 1/1 Running 0 13s 10.200.0.4 worker0
114
110
```
115
111
116
-
117
-
118
112
# # {{% heading "whatsnext" %}}
119
113
120
- Learn more about
121
- [Node Affinity](/docs/concepts/scheduling-eviction/assign-pod-node/# node-affinity).
114
+ [Node Affinity](/docs/concepts/scheduling-eviction/assign-pod-node/# node-affinity)についてさらに学ぶ。
122
115
0 commit comments