@@ -14,30 +14,31 @@ weight: 120
14
14
This page shows how to assign a Kubernetes Pod to a particular node in a
15
15
Kubernetes cluster.
16
16
-->
17
- 此页面显示如何将 Kubernetes Pod 分配给 Kubernetes 集群中的特定节点。
18
-
17
+ 此页面显示如何将 Kubernetes Pod 指派给 Kubernetes 集群中的特定节点。
19
18
20
19
## {{% heading "prerequisites" %}}
21
20
22
21
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
23
22
24
-
25
23
<!-- steps -->
26
24
27
25
<!--
28
26
## Add a label to a node
29
27
30
- 1. List the nodes in your cluster:
28
+ 1. List the {{< glossary_tooltip term_id="node" text=" nodes" >}} in your cluster, along with their labels :
31
29
-->
32
30
## 给节点添加标签
33
31
34
- 1 . 列出集群中的节点
32
+ 1 . 列出你的集群中的{{< glossary_tooltip term_id="node" text="节点" >}},
33
+ 包括这些节点上的标签:
35
34
36
35
``` shell
37
36
kubectl get nodes
38
37
```
39
38
40
- <!-- The output is similar to this: -->
39
+ <!--
40
+ The output is similar to this:
41
+ -->
41
42
输出类似如下:
42
43
43
44
```
@@ -48,9 +49,9 @@ Kubernetes cluster.
48
49
```
49
50
50
51
<!--
51
- 1. Chose one of your nodes, and add a label to it:
52
+ 1. Choose one of your nodes, and add a label to it:
52
53
-->
53
- 2 . 选择其中一个节点 ,为它添加标签:
54
+ 2 . 从你的节点中选择一个 ,为它添加标签:
54
55
55
56
``` shell
56
57
kubectl label nodes < your-node-name> disktype=ssd
@@ -64,7 +65,7 @@ Kubernetes cluster.
64
65
<!--
65
66
1. Verify that your chosen node has a `disktype=ssd` label:
66
67
-->
67
- 3 . 验证你选择的节点是否有 ` disktype=ssd ` 标签:
68
+ 3 . 验证你选择的节点确实带有 ` disktype=ssd ` 标签:
68
69
69
70
``` shell
70
71
kubectl get nodes --show-labels
@@ -94,18 +95,18 @@ This pod configuration file describes a pod that has a node selector,
94
95
`disktype: ssd`. This means that the pod will get scheduled on a node that has
95
96
a `disktype=ssd` label.
96
97
-->
97
- ## 创建一个调度到你选择的节点的 pod
98
+ ## 创建一个将被调度到你选择的节点的 Pod
98
99
99
- 此 Pod 配置文件描述了一个拥有节点选择器 ` disktype: ssd ` 的 Pod。这表明该 Pod 将被调度到
100
- 有 ` disktype=ssd ` 标签的节点。
100
+ 此 Pod 配置文件描述了一个拥有节点选择器 ` disktype: ssd ` 的 Pod。这表明该 Pod
101
+ 将被调度到有 ` disktype=ssd ` 标签的节点。
101
102
102
103
{{< codenew file="pods/pod-nginx.yaml" >}}
103
104
104
105
<!--
105
106
1. Use the configuration file to create a pod that will get scheduled on your
106
107
chosen node:
107
108
-->
108
- 1 . 使用该配置文件去创建一个 pod ,该 pod 将被调度到你选择的节点上:
109
+ 1 . 使用该配置文件创建一个 Pod ,该 Pod 将被调度到你选择的节点上:
109
110
110
111
``` shell
111
112
kubectl create -f https://k8s.io/examples/pods/pod-nginx.yaml
@@ -114,25 +115,44 @@ a `disktype=ssd` label.
114
115
<!--
115
116
1. Verify that the pod is running on your chosen node:
116
117
-->
117
- 2 . 验证 pod 是不是运行在你选择的节点上 :
118
+ 2 . 验证 Pod 确实运行在你选择的节点上 :
118
119
119
120
``` shell
120
121
kubectl get pods --output=wide
121
122
```
122
123
123
- <!-- The output is similar to this: -->
124
+ <!--
125
+ The output is similar to this:
126
+ -->
124
127
输出类似如下:
125
128
126
129
```
127
130
NAME READY STATUS RESTARTS AGE IP NODE
128
131
nginx 1/1 Running 0 13s 10.200.0.4 worker0
129
132
```
130
133
134
+ <!--
135
+ ## Create a pod that gets scheduled to specific node
136
+
137
+ You can also schedule a pod to one specific node via setting `nodeName`.
138
+ -->
139
+ ## 创建一个会被调度到特定节点上的 Pod
140
+
141
+ 你也可以通过设置 ` nodeName ` 将某个 Pod 调度到特定的节点。
142
+
143
+ {{< codenew file="pods/pod-nginx-specific-node.yaml" >}}
144
+
145
+ <!--
146
+ Use the configuration file to create a pod that will get scheduled on `foo-node` only.
147
+ -->
148
+ 使用此配置文件来创建一个 Pod,该 Pod 将只能被调度到 ` foo-node ` 节点。
149
+
131
150
## {{% heading "whatsnext" %}}
132
151
133
152
<!--
134
- Learn more about
135
- [labels and selectors ](/docs/concepts/overview/working-with-objects/labels /).
153
+ * Learn more about [labels and selectors](/docs/concepts/overview/working-with-objects/labels/).
154
+ * Learn more about [nodes ](/docs/concepts/architecture/nodes /).
136
155
-->
137
- 进一步了解[ 标签和选择器] ( /zh-cn/docs/concepts/overview/working-with-objects/labels/ )
156
+ * 进一步了解[ 标签和选择算符] ( /zh-cn/docs/concepts/overview/working-with-objects/labels/ )
157
+ * 进一步了解[ 节点] ( /zh-cn/docs/concepts/architecture/nodes/ )
138
158
0 commit comments