1
1
---
2
2
title : 为节点发布扩展资源
3
3
content_type : task
4
+ weight : 70
4
5
---
5
6
<!--
6
7
title: Advertise Extended Resources for a Node
7
8
content_type: task
9
+ weight: 70
8
10
-->
9
11
10
12
<!-- overview -->
@@ -26,14 +28,16 @@ resources that would otherwise be unknown to Kubernetes.
26
28
<!--
27
29
## Get the names of your Nodes
28
30
29
- Choose one of your Nodes to use for this exercise.
30
31
-->
31
32
## 获取你的节点名称
32
33
33
34
``` shell
34
35
kubectl get nodes
35
36
```
36
37
38
+ <!--
39
+ Choose one of your Nodes to use for this exercise.
40
+ -->
37
41
选择一个节点用于此练习。
38
42
39
43
<!--
@@ -50,7 +54,7 @@ for your Node.
50
54
例如:假设你的一个节点上带有四个 dongle 资源。
51
55
下面是一个 PATCH 请求的示例,该请求为你的节点发布四个 dongle 资源。
52
56
53
- ``` shell
57
+ ```
54
58
PATCH /api/v1/nodes/<your-node-name>/status HTTP/1.1
55
59
Accept: application/json
56
60
Content-Type: application/json-patch+json
@@ -95,13 +99,13 @@ curl --header "Content-Type: application/json-patch+json" \
95
99
http://localhost:8001/api/v1/nodes/< your-node-name> /status
96
100
```
97
101
102
+ {{< note >}}
98
103
<!--
99
104
In the preceding request, `~1` is the encoding for the character / in
100
105
the patch path. The operation path value in JSON-Patch is interpreted as a
101
106
JSON-Pointer. For more details, see
102
107
[IETF RFC 6901](https://tools.ietf.org/html/rfc6901), section 3.
103
108
-->
104
- {{< note >}}
105
109
在前面的请求中,` ~1 ` 为 patch 路径中 “/” 符号的编码。
106
110
JSON-Patch 中的操作路径值被解析为 JSON 指针。
107
111
更多细节,请查看 [ IETF RFC 6901] ( https://tools.ietf.org/html/rfc6901 ) 的第 3 节。
@@ -119,21 +123,25 @@ The output shows that the Node has a capacity of 4 dongles:
119
123
"example.com/dongle": "4",
120
124
```
121
125
122
- <!-- Describe your Node: -->
126
+ <!--
127
+ Describe your Node:
128
+ -->
123
129
描述你的节点:
124
130
125
- ``` shell
131
+ ```
126
132
kubectl describe node <your-node-name>
127
133
```
128
134
129
- <!-- Once again, the output shows the dongle resource: -->
135
+ <!--
136
+ Once again, the output shows the dongle resource:
137
+ -->
130
138
输出再次展示了 dongle 资源:
131
139
132
140
``` yaml
133
141
Capacity :
134
- cpu : 2
135
- memory : 2049008Ki
136
- example.com/dongle : 4
142
+ cpu : 2
143
+ memory : 2049008Ki
144
+ example.com/dongle : 4
137
145
` ` `
138
146
139
147
<!--
@@ -260,9 +268,9 @@ Replace `<your-node-name>` with the name of your Node:
260
268
261
269
``` shell
262
270
curl --header " Content-Type: application/json-patch+json" \
263
- --request PATCH \
264
- --data ' [{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \
265
- http://localhost:8001/api/v1/nodes/< your-node-name> /status
271
+ --request PATCH \
272
+ --data ' [{"op": "remove", "path": "/status/capacity/example.com~1dongle"}]' \
273
+ http://localhost:8001/api/v1/nodes/< your-node-name> /status
266
274
```
267
275
268
276
<!--
@@ -275,29 +283,27 @@ kubectl describe node <your-node-name> | grep dongle
275
283
```
276
284
277
285
<!--
278
- (you should not see any output)
286
+ (you should not see any output)
279
287
-->
280
288
(你应该看不到任何输出)
281
289
282
-
283
290
## {{% heading "whatsnext" %}}
284
291
285
292
<!--
286
293
### For application developers
287
294
288
- * [Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/)
295
+ - [Assign Extended Resources to a Container](/docs/tasks/configure-pod-container/extended-resource/)
289
296
290
297
### For cluster administrators
291
298
292
- * [Configure Minimum and Maximum Memory Constraints for a Namespace](/docs/tasks/administer-cluster/memory-constraint-namespace/)
293
- * [Configure Minimum and Maximum CPU Constraints for a Namespace](/docs/tasks/administer-cluster/cpu-constraint-namespace/)
299
+ - [Configure Minimum and Maximum Memory Constraints for a Namespace](/docs/tasks/administer-cluster/manage-resources /memory-constraint-namespace/)
300
+ - [Configure Minimum and Maximum CPU Constraints for a Namespace](/docs/tasks/administer-cluster/manage-resources /cpu-constraint-namespace/)
294
301
-->
295
302
### 针对应用开发人员
296
303
297
- * [ 将扩展资源分配给容器] ( /zh-cn/docs/tasks/configure-pod-container/extended-resource/ )
298
-
299
- ### 针对集群管理员
304
+ - [ 将扩展资源分配给容器] ( /zh-cn/docs/tasks/configure-pod-container/extended-resource/ )
300
305
301
- * [ 为名字空间配置最小和最大内存约束] ( /zh-cn/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/ )
302
- * [ 为名字空间配置最小和最大 CPU 约束] ( /zh-cn/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/ )
306
+ ### 针对集群管理员
303
307
308
+ - [ 为名字空间配置最小和最大内存约束] ( /zh-cn/docs/tasks/administer-cluster/manage-resources/memory-constraint-namespace/ )
309
+ - [ 为名字空间配置最小和最大 CPU 约束] ( /zh-cn/docs/tasks/administer-cluster/manage-resources/cpu-constraint-namespace/ )
0 commit comments