Skip to content

Commit 3b58bf5

Browse files
authored
Merge pull request #43512 from my-git9/patch-12323
[zh-cn]sync kubelet-config-file inject-data-application/* manage-daemon/*
2 parents e124688 + 1ce0830 commit 3b58bf5

8 files changed

+68
-42
lines changed

content/zh-cn/docs/tasks/administer-cluster/kubelet-config-file.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,35 @@ address: "192.168.0.8"
5959
port: 20250
6060
serializeImagePulls: false
6161
evictionHard:
62-
memory.available: "200Mi"
62+
memory.available: "100Mi"
63+
nodefs.available: "10%"
64+
nodefs.inodesFree: "5%"
65+
imagefs.available: "15%"
6366
```
6467
6568
<!--
66-
In the example, the kubelet is configured to serve on IP address 192.168.0.8 and port 20250, pull images in parallel,
67-
and evict Pods when available memory drops below 200Mi. Since only one of the four evictionHard thresholds is configured,
68-
other evictionHard thresholds are reset to 0 from their built-in defaults.
69-
All other kubelet configuration values are left at their built-in defaults, unless overridden
70-
by flags. Command line flags which target the same value as a config file will override that value.
69+
In this example, the kubelet is configured with the following settings:
70+
-->
71+
在此示例中,kubelet 配置为以下设置:
72+
73+
<!--
74+
1. `address`: The kubelet will serve on IP address `192.168.0.8`.
75+
2. `port`: The kubelet will serve on port `20250`.
76+
3. `serializeImagePulls`: Image pulls will be done in parallel.
77+
4. `evictionHard`: The kubelet will evict Pods under one of the following conditions:
78+
- When the node's available memory drops below 100MiB.
79+
- When the node's main filesystem's available space is less than 10%.
80+
- When the image filesystem's available space is less than 15%.
81+
- When more than 95% of the node's main filesystem's inodes are in use.
7182
-->
72-
在这个示例中, kubelet 被设置为在地址 192.168.0.8 端口 20250 上提供服务,以并行方式拉取镜像,
73-
当可用内存低于 200Mi 时, kubelet 将会开始驱逐 Pod。
74-
由于仅配置了四个 evictionHard 阈值之一,因此其他 evictionHard 阈值被重置为 0,而不是使用其内置默认值。
75-
没有声明的其余配置项都将使用默认值,除非使用命令行参数来重载。
76-
命令行中的参数将会覆盖配置文件中的对应值。
83+
1. `address`:kubelet 将在 `192.168.0.8` IP 地址上提供服务。
84+
2. `port`:kubelet 将在 `20250` 端口上提供服务。
85+
3. `serializeImagePulls`:并行拉取镜像。
86+
4. `evictionHard`:kubelet 将在以下情况之一驱逐 Pod:
87+
- 当节点的可用内存降至 100MiB 以下时。
88+
- 当节点主文件系统的已使用 inode 超过 95%。
89+
- 当镜像文件系统的可用空间小于 15% 时。
90+
- 当节点主文件系统的 inode 超过 95% 正在使用时。
7791

7892
{{< note >}}
7993
<!--
@@ -86,6 +100,12 @@ the threshold values respectively.
86100
其他参数的默认值将不会被继承,他们会被设置为零。如果要提供自定义值,你应该分别设置所有阈值。
87101
{{< /note >}}
88102

103+
<!--
104+
The `imagefs` is an optional filesystem that container runtimes use to store container
105+
images and container writable layers.
106+
-->
107+
`imagefs` 是一个可选的文件系统,容器运行时使用它来存储容器镜像和容器可写层。
108+
89109
<!--
90110
## Start a kubelet process configured via the config file
91111
--->

content/zh-cn/docs/tasks/inject-data-application/define-environment-variable-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Pod:
8080
本示例中,将创建一个只包含单个容器的 Pod。此 Pod 的配置文件中设置环境变量的名称为 `DEMO_GREETING`
8181
其值为 `"Hello from the environment"`。下面是此 Pod 的配置清单:
8282

83-
{{< codenew file="pods/inject/envars.yaml" >}}
83+
{{% code_sample file="pods/inject/envars.yaml" %}}
8484

8585
<!--
8686
1. Create a Pod based on that manifest:

content/zh-cn/docs/tasks/inject-data-application/define-interdependent-environment-variables.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ in a Kubernetes Pod.
2424
<!--
2525
## Define an environment dependent variable for a container
2626
27-
When you create a Pod, you can set dependent environment variables for the containers that run in the Pod. To set dependent environment variables, you can use $(VAR_NAME) in the `value` of `env` in the configuration file.
27+
When you create a Pod, you can set dependent environment variables for the containers
28+
that run in the Pod. To set dependent environment variables, you can use $(VAR_NAME)
29+
in the `value` of `env` in the configuration file.
2830
2931
In this exercise, you create a Pod that runs one container. The configuration
3032
file for the Pod defines a dependent environment variable with common usage defined. Here is the configuration manifest for the
@@ -39,7 +41,7 @@ Pod:
3941
此 Pod 的配置文件定义了一个已定义常用用法的相互依赖的环境变量。
4042
下面是此 Pod 的配置清单:
4143

42-
{{< codenew file="pods/inject/dependent-envars.yaml" >}}
44+
{{% code_sample file="pods/inject/dependent-envars.yaml" %}}
4345

4446
<!--
4547
1. Create a Pod based on that manifest:
@@ -82,7 +84,8 @@ Pod:
8284
```
8385

8486
<!--
85-
As shown above, you have defined the correct dependency reference of `SERVICE_ADDRESS`, bad dependency reference of `UNCHANGED_REFERENCE` and skip dependent references of `ESCAPED_REFERENCE`.
87+
As shown above, you have defined the correct dependency reference of `SERVICE_ADDRESS`,
88+
bad dependency reference of `UNCHANGED_REFERENCE` and skip dependent references of `ESCAPED_REFERENCE`.
8689
8790
When an environment variable is already defined when being referenced,
8891
the reference can be correctly resolved, such as in the `SERVICE_ADDRESS` case.
@@ -104,7 +107,10 @@ fails to resolve `$(PROTOCOL)` in the example above.
104107
这就是为什么 `UNCHANGED_REFERENCE` 在上面的示例中解析 `$(PROTOCOL)` 失败的原因。
105108

106109
<!--
107-
When the environment variable is undefined or only includes some variables, the undefined environment variable is treated as a normal string, such as `UNCHANGED_REFERENCE`. Note that incorrectly parsed environment variables, in general, will not block the container from starting.
110+
When the environment variable is undefined or only includes some variables,
111+
the undefined environment variable is treated as a normal string, such as
112+
`UNCHANGED_REFERENCE`. Note that incorrectly parsed environment variables,
113+
in general, will not block the container from starting.
108114
109115
The `$(VAR_NAME)` syntax can be escaped with a double `$`, ie: `$$(VAR_NAME)`.
110116
Escaped references are never expanded, regardless of whether the referenced variable
@@ -126,4 +132,3 @@ is defined or not. This can be seen from the `ESCAPED_REFERENCE` case above.
126132
-->
127133
* 进一步了解[环境变量](/zh-cn/docs/tasks/inject-data-application/environment-variable-expose-pod-information/)
128134
* 参阅 [EnvVarSource](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#envvarsource-v1-core)。
129-

content/zh-cn/docs/tasks/inject-data-application/distribute-credentials-secure.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ username and password:
6565

6666
这里是一个配置文件,可以用来创建存有用户名和密码的 Secret:
6767

68-
{{% code file="pods/inject/secret.yaml" %}}
68+
{{% code_sample file="pods/inject/secret.yaml" %}}
6969

7070
<!--
7171
1. Create the Secret
@@ -154,7 +154,7 @@ Here is a configuration file you can use to create a Pod:
154154

155155
这里是一个可以用来创建 Pod 的配置文件:
156156

157-
{{% code file="pods/inject/secret-pod.yaml" %}}
157+
{{% code_sample file="pods/inject/secret-pod.yaml" %}}
158158

159159
1. <!-- Create the Pod:-->
160160
创建 Pod:
@@ -398,7 +398,7 @@ secrets change.
398398
-->
399399
- 在 Pod 规约中,将 Secret 中定义的值 `backend-username` 赋给 `SECRET_USERNAME` 环境变量。
400400

401-
{{% code file="pods/inject/pod-single-secret-env-variable.yaml" %}}
401+
{{% code_sample file="pods/inject/pod-single-secret-env-variable.yaml" %}}
402402

403403
<!--
404404
- Create the Pod:
@@ -447,7 +447,7 @@ secrets change.
447447
-->
448448
- 在 Pod 规约中定义环境变量:
449449

450-
{{% code file="pods/inject/pod-multiple-secret-env-variable.yaml" %}}
450+
{{% code_sample file="pods/inject/pod-multiple-secret-env-variable.yaml" %}}
451451

452452
<!--
453453
- Create the Pod:
@@ -505,7 +505,7 @@ This functionality is available in Kubernetes v1.6 and later.
505505
- 使用 `envFrom` 来将 Secret 中的所有数据定义为环境变量。
506506
Secret 中的键名成为容器中的环境变量名:
507507

508-
{{% code file="pods/inject/pod-secret-envFrom.yaml" %}}
508+
{{% code_sample file="pods/inject/pod-secret-envFrom.yaml" %}}
509509

510510
<!--
511511
- Create the Pod:

content/zh-cn/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Here is the manifest for the Pod:
5656
在这部分的练习中,你将创建一个包含一个容器的 Pod,并将 Pod 级别的字段作为文件投射到正在运行的容器中。
5757
Pod 的清单如下:
5858

59-
{{< codenew file="pods/inject/dapi-volume.yaml" >}}
59+
{{% code_sample file="pods/inject/dapi-volume.yaml" %}}
6060

6161
<!--
6262
In the manifest, you can see that the Pod has a `downwardAPI` Volume,
@@ -148,7 +148,7 @@ In your shell, view the `labels` file:
148148
The output shows that all of the Pod's labels have been written
149149
to the `labels` file:
150150
-->
151-
输出显示 Pod 的所有标签都已写入 `labels` 文件
151+
输出显示 Pod 的所有标签都已写入 `labels` 文件
152152

153153
```
154154
cluster="test-cluster1"
@@ -245,7 +245,7 @@ just one container:
245245
但这些字段取自特定[容器](/zh-cn/docs/reference/kubernetes-api/workload-resources/pod-v1/#Container)而不是整个 Pod。
246246
下面是一个同样只有一个容器的 Pod 的清单:
247247

248-
{{< codenew file="pods/inject/dapi-volume-resources.yaml" >}}
248+
{{% code_sample file="pods/inject/dapi-volume-resources.yaml" %}}
249249

250250
<!--
251251
In the manifest, you can see that the Pod has a
@@ -355,4 +355,3 @@ Read about volumes in the legacy API reference:
355355
* 参阅
356356
[`ResourceFieldSelector`](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#resourcefieldselector-v1-core)
357357
API 定义,该 API 指定容器资源及其输出格式。
358-

content/zh-cn/docs/tasks/inject-data-application/environment-variable-expose-pod-information.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ project Pod-level fields into the running container as environment variables.
6060

6161
在这部分练习中,你将创建一个包含一个容器的 Pod。并将 Pod 级别的字段作为环境变量投射到正在运行的容器中。
6262

63-
{{< codenew file="pods/inject/dapi-envars-pod.yaml" >}}
63+
{{% code_sample file="pods/inject/dapi-envars-pod.yaml" %}}
6464

6565
<!--
6666
In that manifest, you can see five environment variables. The `env`
@@ -185,7 +185,7 @@ Here is a manifest for another Pod that again has just one container:
185185

186186
这里是只包含一个容器的 Pod 的清单:
187187

188-
{{< codenew file="pods/inject/dapi-envars-container.yaml" >}}
188+
{{% code_sample file="pods/inject/dapi-envars-container.yaml" %}}
189189

190190
<!--
191191
In this manifest, you can see four environment variables. The `env`
@@ -271,4 +271,3 @@ Read about Pods, containers and environment variables in the legacy API referenc
271271
* [EnvVarSource](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#envvarsource-v1-core)
272272
* [ObjectFieldSelector](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#objectfieldselector-v1-core)
273273
* [ResourceFieldSelector](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#resourcefieldselector-v1-core)
274-

content/zh-cn/docs/tasks/manage-daemon/pods-some-nodes.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ weight: 30
1212
<!-- overview -->
1313

1414
<!--
15-
This page demonstrates how can you run {{<glossary_tooltip term_id="pod" text="Pods">}} on only some {{<glossary_tooltip term_id="node" text="Nodes">}} as part of a {{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}
15+
This page demonstrates how can you run {{<glossary_tooltip term_id="pod" text="Pods">}}
16+
on only some {{<glossary_tooltip term_id="node" text="Nodes">}} as part of a
17+
{{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}
1618
-->
1719
本页演示了你如何能够仅在某些{{<glossary_tooltip term_id="node" text="节点">}}上作为
1820
{{<glossary_tooltip term_id="daemonset" text="DaemonSet">}}
@@ -51,7 +53,8 @@ kubectl label nodes example-node-1 example-node-2 ssd=true
5153
<!--
5254
### Step 2: Create the manifest
5355
54-
Let's create a {{<glossary_tooltip term_id="daemonset" text="DaemonSet">}} which will provision the daemon pods on the SSD labeled {{<glossary_tooltip term_id="node" text="nodes">}} only.
56+
Let's create a {{<glossary_tooltip term_id="daemonset" text="DaemonSet">}} which
57+
will provision the daemon pods on the SSD labeled {{<glossary_tooltip term_id="node" text="nodes">}} only.
5558
5659
Next, use a `nodeSelector` to ensure that the DaemonSet only runs Pods on nodes
5760
with the `ssd` label set to `"true"`.
@@ -63,7 +66,7 @@ with the `ssd` label set to `"true"`.
6366

6467
接下来,使用 `nodeSelector` 确保 DaemonSet 仅在 `ssd` 标签设为 `"true"` 的节点上运行 Pod。
6568

66-
{{<codenew file="controllers/daemonset-label-selector.yaml">}}
69+
{{% code_sample file="controllers/daemonset-label-selector.yaml" %}}
6770

6871
<!--
6972
### Step 3: Create the DaemonSet

content/zh-cn/docs/tasks/manage-daemon/update-daemon-set.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ DaemonSet 有两种更新策略:
4545
the DaemonSet will be running on each node during the whole update process.
4646
-->
4747

48-
* `OnDelete`: 使用 `OnDelete` 更新策略时,在更新 DaemonSet 模板后,只有当你手动删除老的
49-
DaemonSet pods 之后,新的 DaemonSet Pod **才会**被自动创建。跟 Kubernetes 1.6 以前的版本类似。
50-
* `RollingUpdate`: 这是默认的更新策略。使用 `RollingUpdate` 更新策略时,在更新 DaemonSet 模板后,
48+
* `OnDelete`使用 `OnDelete` 更新策略时,在更新 DaemonSet 模板后,只有当你手动删除老的
49+
DaemonSet Pod 之后,新的 DaemonSet Pod **才会**被自动创建。跟 Kubernetes 1.6 以前的版本类似。
50+
* `RollingUpdate`这是默认的更新策略。使用 `RollingUpdate` 更新策略时,在更新 DaemonSet 模板后,
5151
老的 DaemonSet Pod 将被终止,并且将以受控方式自动创建新的 DaemonSet Pod。
5252
更新期间,最多只能有 DaemonSet 的一个 Pod 运行于每个节点上。
5353

@@ -71,8 +71,8 @@ You may want to set
7171
(defaults to 0) as well.
7272
-->
7373
你可能想设置
74-
[`.spec.updateStrategy.rollingUpdate.maxUnavailable`](/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec) (默认为 1),
75-
[`.spec.minReadySeconds`](/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec) (默认为 0)
74+
[`.spec.updateStrategy.rollingUpdate.maxUnavailable`](/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec)默认为 1)、
75+
[`.spec.minReadySeconds`](/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec)默认为 0
7676
[`.spec.updateStrategy.rollingUpdate.maxSurge`](/zh-cn/docs/reference/kubernetes-api/workload-resources/daemon-set-v1/#DaemonSetSpec)
7777
(默认为 0)。
7878

@@ -85,7 +85,7 @@ This YAML file specifies a DaemonSet with an update strategy as 'RollingUpdate'
8585

8686
下面的 YAML 包含一个 DaemonSet,其更新策略为 'RollingUpdate':
8787

88-
{{< codenew file="controllers/fluentd-daemonset.yaml" >}}
88+
{{% code_sample file="controllers/fluentd-daemonset.yaml" %}}
8989

9090
<!--
9191
After verifying the update strategy of the DaemonSet manifest, create the DaemonSet:
@@ -115,7 +115,7 @@ Check the update strategy of your DaemonSet, and make sure it's set to
115115
-->
116116
### 检查 DaemonSet 的滚动更新策略 {#checking-daemonset-rollingupdate-update-strategy}
117117

118-
首先,检查 DaemonSet 的更新策略,确保已经将其设置为 `RollingUpdate`:
118+
首先,检查 DaemonSet 的更新策略,确保已经将其设置为 `RollingUpdate`
119119

120120
```shell
121121
kubectl get ds/fluentd-elasticsearch -o go-template='{{.spec.updateStrategy.type}}{{"\n"}}' -n kube-system
@@ -157,7 +157,7 @@ update. Let's update the DaemonSet by applying a new YAML file. This can be done
157157
`RollingUpdate` DaemonSet 的 `.spec.template` 的任何更新都将触发滚动更新。
158158
这可以通过几个不同的 `kubectl` 命令来完成。
159159

160-
{{< codenew file="controllers/fluentd-daemonset-update.yaml" >}}
160+
{{% code_sample file="controllers/fluentd-daemonset-update.yaml" %}}
161161

162162
<!--
163163
#### Declarative commands
@@ -278,7 +278,7 @@ replicated. This does not respect [PodDisruptionBudget](/docs/tasks/run-applicat
278278
either.
279279
-->
280280
{{< note >}}
281-
当所删除的 Pod 不受任何控制器管理,也不是多副本的 Pod时,上述操作将导致服务中断。
281+
当所删除的 Pod 不受任何控制器管理,也不是多副本的 Pod 时,上述操作将导致服务中断。
282282
同时,上述操作也不会考虑
283283
[PodDisruptionBudget](/zh-cn/docs/tasks/run-application/configure-pdb/)
284284
所施加的约束。
@@ -317,7 +317,7 @@ DaemonSet 无法检测到正确的滚动更新进度。
317317
<!--
318318
## Clean up
319319
320-
Delete DaemonSet from a namespace :
320+
Delete DaemonSet from a namespace:
321321
-->
322322
## 清理 {#clean-up}
323323

0 commit comments

Comments
 (0)