Skip to content

Commit 03e4a9e

Browse files
authored
Merge pull request #23196 from tengqm/zh-links-tasks-5
[zh] Tidy up and fix links in tasks section (5/10)
2 parents bdd0415 + 68abcb9 commit 03e4a9e

11 files changed

+903
-761
lines changed
Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,137 @@
11
---
2-
reviewers:
3-
- mtaufen
4-
- dawnchen
52
title: 通过配置文件设置 Kubelet 参数
63
content_type: task
74
---
85
<!--
9-
---
106
reviewers:
117
- mtaufen
128
- dawnchen
139
title: Set Kubelet parameters via a config file
1410
content_type: task
15-
---
1611
--->
1712

1813
<!-- overview -->
19-
{{< feature-state state="beta" >}}
14+
15+
{{< feature-state for_k8s_version="v1.10" state="beta" >}}
2016

2117
<!--
2218
A subset of the Kubelet's configuration parameters may be
2319
set via an on-disk config file, as a substitute for command-line flags.
2420
This functionality is considered beta in v1.10.
2521
--->
26-
通过保存在硬盘的配置文件设置 Kubelet 的配置参数子集,可以作为命令行参数的替代。此功能在 v1.10 中为 beta 版。
22+
通过保存在硬盘的配置文件设置 kubelet 的部分配置参数,这可以作为命令行参数的替代。
23+
此功能在 v1.10 中为 beta 版。
2724

2825
<!--
2926
Providing parameters via a config file is the recommended approach because
3027
it simplifies node deployment and configuration management.
3128
--->
3229
建议通过配置文件的方式提供参数,因为这样可以简化节点部署和配置管理。
3330

34-
35-
3631
## {{% heading "prerequisites" %}}
3732

38-
3933
<!--
4034
- A v1.10 or higher Kubelet binary must be installed for beta functionality.
41-
--->
42-
- 需要安装 1.10 或更高版本的 Kubelet 二进制文件,才能实现 beta 功能。
43-
44-
35+
-->
36+
- 需要安装 1.10 或更高版本的 kubelet 可执行文件,才能使用此 beta 功能。
4537

4638
<!-- steps -->
4739

4840
<!--
4941
## Create the config file
50-
--->
51-
## 创建配置文件
5242
43+
The subset of the Kubelet's configuration that can be configured via a file
44+
is defined by the `KubeletConfiguration` struct
45+
[here (v1beta1)](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go).
46+
-->
47+
## 创建配置文件
5348

54-
`KubeletConfiguration` 结构体定义了可以通过文件配置的 Kubelet 配置子集,该结构体在 [这里(v1beta1)](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go) 可以找到, 配置文件必须是这个结构体中参数的 JSON 或 YAML 表现形式。
49+
`KubeletConfiguration` 结构体定义了可以通过文件配置的 Kubelet 配置子集,
50+
该结构体在 [这里(v1beta1)](https://github.com/kubernetes/kubernetes/blob/{{< param "docsbranch" >}}/staging/src/k8s.io/kubelet/config/v1beta1/types.go)
51+
可以找到。
5552

53+
<!--
54+
The configuration file must be a JSON or YAML representation of the parameters
55+
in this struct. Make sure the Kubelet has read permissions on the file.
5656
57-
在单独的文件夹中创建一个名为 `kubelet` 的文件,并保证 Kubelet 可以读取该文件夹及文件。您应该在这个 `kubelet` 文件中编写 Kubelet 配置。
57+
Here is an example of what this file might look like:
58+
-->
59+
配置文件必须是这个结构体中参数的 JSON 或 YAML 表现形式。
60+
确保 kubelet 可以读取该文件。
5861

59-
这是一个 Kubelet 配置文件示例:
62+
下面是一个 Kubelet 配置文件示例:
6063

61-
```
64+
```yaml
6265
kind: KubeletConfiguration
6366
apiVersion: kubelet.config.k8s.io/v1beta1
6467
evictionHard:
6568
memory.available: "200Mi"
6669
```
67-
在这个示例中, 当可用内存低于200Mi 时, Kubelet 将会开始驱逐 Pods。 没有声明的其余配置项都将使用默认值, 命令行中的 flags 将会覆盖配置文件中的对应值。
68-
6970
70-
作为一个小技巧,您可以从活动节点生成配置文件,相关方法请查看 [重新配置活动集群节点的 Kubelet](/docs/tasks/administer-cluster/reconfigure-kubelet)
71+
<!--
72+
In the example, the Kubelet is configured to evict Pods when available memory drops below 200Mi.
73+
All other Kubelet configuration values are left at their built-in defaults, unless overridden
74+
by flags. Command line flags which target the same value as a config file will override that value.
7175
76+
For a trick to generate a configuration file from a live node, see
77+
[Reconfigure a Node's Kubelet in a Live Cluster](/docs/tasks/administer-cluster/reconfigure-kubelet).
78+
-->
79+
在这个示例中, 当可用内存低于 200Mi 时, kubelet 将会开始驱逐 Pods。
80+
没有声明的其余配置项都将使用默认值,除非使用命令行参数来重载。
81+
命令行中的参数将会覆盖配置文件中的对应值。
7282
73-
## 启动通过配置文件配置的 Kubelet 进程
83+
作为一个小技巧,你可以从活动节点生成配置文件,相关方法请查看
84+
[重新配置活动集群节点的 kubelet](/zh/docs/tasks/administer-cluster/reconfigure-kubelet)。
7485
7586
<!--
87+
## Start a Kubelet process configured via the config file
88+
7689
Start the Kubelet with the `--config` flag set to the path of the Kubelet's config file.
7790
The Kubelet will then load its config from this file.
7891
--->
92+
93+
## 启动通过配置文件配置的 Kubelet 进程
94+
7995
启动 Kubelet 需要将 `--config` 参数设置为 Kubelet 配置文件的路径。Kubelet 将从此文件加载其配置。
8096

8197
<!--
8298
Note that command line flags which target the same value as a config file will override that value.
8399
This helps ensure backwards compatibility with the command-line API.
84-
--->
85-
请注意,命令行参数与配置文件有相同的值时,就会覆盖配置文件中的该值。这有助于确保命令行 API 的向后兼容性。
100+
-->
101+
请注意,命令行参数与配置文件有相同的值时,就会覆盖配置文件中的该值。
102+
这有助于确保命令行 API 的向后兼容性。
86103

87104
<!--
88105
Note that relative file paths in the Kubelet config file are resolved relative to the
89106
location of the Kubelet config file, whereas relative paths in command line flags are resolved
90107
relative to the Kubelet's current working directory.
91-
--->
92-
请注意,Kubelet 配置文件中的相对文件路径是相对于 Kubelet 配置文件的位置解析的,而命令行参数中的相对路径是相对于 Kubelet 的当前工作目录解析的。
108+
-->
109+
请注意,kubelet 配置文件中的相对文件路径是相对于 kubelet 配置文件的位置解析的,
110+
而命令行参数中的相对路径是相对于 kubelet 的当前工作目录解析的。
93111

94112
<!--
95113
Note that some default values differ between command-line flags and the Kubelet config file.
96114
If `--config` is provided and the values are not specified via the command line, the
97115
defaults for the `KubeletConfiguration` version apply.
98116
In the above example, this version is `kubelet.config.k8s.io/v1beta1`.
99117
--->
100-
请注意,命令行参数和 Kubelet 配置文件的某些默认值不同。如果设置了 `--config`,并且没有通过命令行指定值,则 `KubeletConfiguration` 版本的默认值生效。在上面的例子中,version 是 `kubelet.config.k8s.io/v1beta1`
101-
102-
118+
请注意,命令行参数和 Kubelet 配置文件的某些默认值不同。
119+
如果设置了 `--config`,并且没有通过命令行指定值,则 `KubeletConfiguration`
120+
版本的默认值生效。在上面的例子中,version 是 `kubelet.config.k8s.io/v1beta1`。
103121

104122
<!-- discussion -->
105123

106124
<!--
107125
## Relationship to Dynamic Kubelet Config
108-
--->
109-
## 与动态 Kubelet 配置的关系
110126

111-
<!--
112127
If you are using the [Dynamic Kubelet Configuration](/docs/tasks/administer-cluster/reconfigure-kubelet)
113128
feature, the combination of configuration provided via `--config` and any flags which override these values
114129
is considered the default "last known good" configuration by the automatic rollback mechanism.
115130
--->
116-
如果您正在使用 [动态 Kubelet 配置](/docs/tasks/administer-cluster/reconfigure-kubelet) 特性,那么自动回滚机制将认为是 "最后已知正常(last known good)" 的配置,通过 `--config` 提供的配置与覆盖这些值的任何参数的结合。
131+
## 与动态 Kubelet 配置的关系
117132

133+
如果你正在使用[动态 kubelet 配置](/zh/docs/tasks/administer-cluster/reconfigure-kubelet)特性,
134+
那么自动回滚机制将认为通过 `--config` 提供的配置与覆盖这些值的任何参数的组合是
135+
"最后已知正常(last known good)" 的配置。
118136

119137

content/zh/docs/tasks/configure-pod-container/assign-pods-nodes.md

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ content_type: task
44
weight: 120
55
---
66
<!--
7-
---
87
title: Assign Pods to Nodes
98
content_type: task
109
weight: 120
11-
---
1210
-->
1311

1412
<!-- overview -->
@@ -21,82 +19,84 @@ Kubernetes cluster.
2119

2220
## {{% heading "prerequisites" %}}
2321

24-
2522
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
2623

2724

28-
2925
<!-- steps -->
3026

3127
<!--
3228
## Add a label to a node
33-
-->
34-
## 给节点添加标签
3529
36-
<!--
3730
1. List the nodes in your cluster:
3831
-->
32+
## 给节点添加标签
33+
3934
1. 列出集群中的节点
4035

41-
kubectl get nodes
36+
```shell
37+
kubectl get nodes
38+
```
4239

43-
<!--
44-
The output is similar to this:
45-
-->
46-
输出类似如下:
40+
<!-- The output is similar to this: -->
41+
输出类似如下:
4742

48-
NAME STATUS AGE VERSION
49-
worker0 Ready 1d v1.6.0+fff5156
50-
worker1 Ready 1d v1.6.0+fff5156
51-
worker2 Ready 1d v1.6.0+fff5156
43+
```
44+
NAME STATUS AGE VERSION
45+
worker0 Ready 1d v1.6.0+fff5156
46+
worker1 Ready 1d v1.6.0+fff5156
47+
worker2 Ready 1d v1.6.0+fff5156
48+
```
5249

5350
<!--
5451
1. Chose one of your nodes, and add a label to it:
5552
-->
56-
1. 选择其中一个节点,为它添加标签:
53+
2. 选择其中一个节点,为它添加标签:
5754

58-
kubectl label nodes <your-node-name> disktype=ssd
55+
```shell
56+
kubectl label nodes <your-node-name> disktype=ssd
57+
```
5958

60-
<!--
61-
where `<your-node-name>` is the name of your chosen node.
62-
-->
63-
`<your-node-name>` 是你选择的节点的名称。
59+
<!--
60+
where `<your-node-name>` is the name of your chosen node.
61+
-->
62+
`<your-node-name>` 是你选择的节点的名称。
6463

6564
<!--
6665
1. Verify that your chosen node has a `disktype=ssd` label:
6766
-->
68-
1. 验证你选择的节点是否有 `disktype=ssd` 标签:
69-
70-
kubectl get nodes --show-labels
71-
72-
73-
<!--
74-
The output is similar to this:
75-
-->
76-
输出类似如下:
77-
78-
NAME STATUS AGE VERSION LABELS
79-
worker0 Ready 1d v1.6.0+fff5156 ...,disktype=ssd,kubernetes.io/hostname=worker0
80-
worker1 Ready 1d v1.6.0+fff5156 ...,kubernetes.io/hostname=worker1
81-
worker2 Ready 1d v1.6.0+fff5156 ...,kubernetes.io/hostname=worker2
82-
83-
<!--
84-
In the preceding output, you can see that the `worker0` node has a
85-
`disktype=ssd` label.
86-
-->
87-
在前面的输出中,你可以看到 `worker0` 节点有 `disktype=ssd` 标签。
67+
3. 验证你选择的节点是否有 `disktype=ssd` 标签:
68+
69+
```shell
70+
kubectl get nodes --show-labels
71+
```
72+
73+
<!--
74+
The output is similar to this:
75+
-->
76+
输出类似如下:
77+
78+
```
79+
NAME STATUS AGE VERSION LABELS
80+
worker0 Ready 1d v1.6.0+fff5156 ...,disktype=ssd,kubernetes.io/hostname=worker0
81+
worker1 Ready 1d v1.6.0+fff5156 ...,kubernetes.io/hostname=worker1
82+
worker2 Ready 1d v1.6.0+fff5156 ...,kubernetes.io/hostname=worker2
83+
```
84+
<!--
85+
In the preceding output, you can see that the `worker0` node has a
86+
`disktype=ssd` label.
87+
-->
88+
在前面的输出中,你可以看到 `worker0` 节点有 `disktype=ssd` 标签。
8889

8990
<!--
9091
## Create a pod that gets scheduled to your chosen node
91-
-->
92-
## 创建一个调度到你选择的节点的 pod
9392
94-
<!--
9593
This pod configuration file describes a pod that has a node selector,
9694
`disktype: ssd`. This means that the pod will get scheduled on a node that has
9795
a `disktype=ssd` label.
9896
-->
99-
该 pod 配置文件描述了一个拥有节点选择器 `disktype: ssd` 的 pod。这表明该 pod 将被调度到
97+
## 创建一个调度到你选择的节点的 pod
98+
99+
此 Pod 配置文件描述了一个拥有节点选择器 `disktype: ssd` 的 Pod。这表明该 Pod 将被调度到
100100
`disktype=ssd` 标签的节点。
101101

102102
{{< codenew file="pods/pod-nginx.yaml" >}}
@@ -107,31 +107,32 @@ a `disktype=ssd` label.
107107
-->
108108
1. 使用该配置文件去创建一个 pod,该 pod 将被调度到你选择的节点上:
109109

110-
kubectl create -f https://k8s.io/examples/pods/pod-nginx.yaml
110+
```shell
111+
kubectl create -f https://k8s.io/examples/pods/pod-nginx.yaml
112+
```
111113

112114
<!--
113115
1. Verify that the pod is running on your chosen node:
114116
-->
115-
1. 验证 pod 是不是运行在你选择的节点上:
116-
117-
kubectl get pods --output=wide
118-
119-
<!--
120-
The output is similar to this:
121-
-->
122-
输出类似如下:
117+
2. 验证 pod 是不是运行在你选择的节点上:
123118

124-
NAME READY STATUS RESTARTS AGE IP NODE
125-
nginx 1/1 Running 0 13s 10.200.0.4 worker0
119+
```shell
120+
kubectl get pods --output=wide
121+
```
126122

123+
<!-- The output is similar to this: -->
124+
输出类似如下:
127125

126+
```
127+
NAME READY STATUS RESTARTS AGE IP NODE
128+
nginx 1/1 Running 0 13s 10.200.0.4 worker0
129+
```
128130

129131
## {{% heading "whatsnext" %}}
130132

131133
<!--
132134
Learn more about
133135
[labels and selectors](/docs/concepts/overview/working-with-objects/labels/).
134136
-->
135-
了解更多关于
136-
[标签和选择器](/docs/concepts/overview/working-with-objects/labels/)
137+
进一步了解[标签和选择器](/zh/docs/concepts/overview/working-with-objects/labels/)
137138

0 commit comments

Comments
 (0)