Skip to content

Commit 41b223e

Browse files
committed
[zh-cn]sync kubectl/_index node/_index swap-behavior
Signed-off-by: xin.li <[email protected]>
1 parent b032889 commit 41b223e

3 files changed

Lines changed: 81 additions & 19 deletions

File tree

content/zh-cn/docs/reference/kubectl/_index.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ files by setting the `KUBECONFIG` environment variable or by setting the
3737
针对配置信息,`kubectl``$HOME/.kube` 目录中查找一个名为 `config` 的配置文件。
3838
你可以通过设置 `KUBECONFIG` 环境变量或设置
3939
[`--kubeconfig`](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
40-
4140
参数来指定其它 [kubeconfig](/zh-cn/docs/concepts/configuration/organize-cluster-access-kubeconfig/) 文件。
4241

4342
<!--
@@ -123,7 +122,7 @@ where `command`, `TYPE`, `NAME`, and `flags` are:
123122
124123
* To specify resources with one or more files: `-f file1 -f file2 -f file<#>`
125124
126-
* [Use YAML rather than JSON](/docs/concepts/configuration/overview/#general-configuration-tips)
125+
* Use YAML rather than JSON
127126
since YAML tends to be more user-friendly, especially for configuration files.<br/>
128127
Example: `kubectl get -f ./pod.yaml`
129128
-->
@@ -137,15 +136,14 @@ where `command`, `TYPE`, `NAME`, and `flags` are:
137136

138137
* 用一个或多个文件指定资源:`-f file1 -f file2 -f file<#>`
139138

140-
* [使用 YAML 而不是 JSON](/zh-cn/docs/concepts/configuration/overview/#general-configuration-tips)
141-
因为 YAML 对用户更友好, 特别是对于配置文件。<br/>
139+
* 使用 YAML 而不是 JSON 因为 YAML 对用户更友好, 特别是对于配置文件。<br/>
142140
例子:`kubectl get -f ./pod.yaml`
143141

144142
<!--
145143
* `flags`: Specifies optional flags. For example, you can use the `-s` or `--server` flags
146144
to specify the address and port of the Kubernetes API server.<br/>
147145
-->
148-
* `flags` 指定可选的参数。例如,可以使用 `-s``--server` 参数指定
146+
* `flags`:指定可选的参数。例如,可以使用 `-s``--server` 参数指定
149147
Kubernetes API 服务器的地址和端口。
150148

151149
{{< caution >}}
@@ -315,7 +313,7 @@ Operation | Syntax | Description
315313
`apply` | `kubectl apply -f FILENAME [flags]`| 从文件或 stdin 对资源应用配置更改。
316314
`attach` | `kubectl attach POD -c CONTAINER [-i] [-t] [flags]` | 挂接到正在运行的容器,查看输出流或与容器(stdin)交互。
317315
`auth` | `kubectl auth [flags] [options]` | 检查授权。
318-
`autoscale` | <code>kubectl autoscale (-f FILENAME &#124; TYPE NAME &#124; TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]</code> | 自动扩缩由副本控制器管理的一组 pod
316+
`autoscale` | <code>kubectl autoscale (-f FILENAME &#124; TYPE NAME &#124; TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]</code> | 自动扩缩由副本控制器管理的一组 Pod
319317
`certificate` | `kubectl certificate SUBCOMMAND [options]` | 修改证书资源。
320318
`cluster-info` | `kubectl cluster-info [flags]` | 显示有关集群中主服务器和服务的端口信息。
321319
`completion` | `kubectl completion SHELL [options]` | 为指定的 Shell(Bash 或 Zsh)输出 Shell 补齐代码。
@@ -334,7 +332,7 @@ Operation | Syntax | Description
334332
`explain` | `kubectl explain TYPE [--recursive=false] [flags]` | 获取多种资源的文档。例如 Pod、Node、Service 等。
335333
`expose` | <code>kubectl expose (-f FILENAME &#124; TYPE NAME &#124; TYPE/NAME) [--port=port] [--protocol=TCP&#124;UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags]</code> | 将副本控制器、Service 或 Pod 作为新的 Kubernetes 服务暴露。
336334
`get` | <code>kubectl get (-f FILENAME &#124; TYPE [NAME &#124; /NAME &#124; -l label]) [--watch] [--sort-by=FIELD] [[-o &#124; --output]=OUTPUT_FORMAT] [flags]</code> | 列出一个或多个资源。
337-
`kustomize` | <code>kubectl kustomize <dir> [flags] [options]` </code> | 列出从 kustomization.yaml 文件中的指令生成的一组 API 资源。参数必须是包含文件的目录的路径,或者是 git 存储库 URL,其路径后缀相对于存储库根目录指定了相同的路径。
335+
`kustomize` | <code>kubectl kustomize <dir> [flags] [options]` </code> | 列出从 kustomization.yaml 文件中的指令生成的一组 API 资源。参数必须是包含文件的目录的路径,或者是 Git 存储库 URL,其路径后缀相对于存储库根目录指定了相同的路径。
338336
`label` | <code>kubectl label (-f FILENAME &#124; TYPE NAME &#124; TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags]</code> | 添加或更新一个或多个资源的标签。
339337
`logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | 打印 Pod 中容器的日志。
340338
`options` | `kubectl options` | 全局命令行选项列表,这些选项适用于所有命令。
@@ -356,8 +354,8 @@ Operation | Syntax | Description
356354
<!--
357355
To learn more about command operations, see the [kubectl](/docs/reference/kubectl/kubectl/) reference documentation.
358356
-->
359-
了解更多有关命令操作的信息,
360-
请参阅 [kubectl](/zh-cn/docs/reference/kubectl/kubectl/) 参考文档。
357+
了解更多有关命令操作的信息,请参阅
358+
[kubectl](/zh-cn/docs/reference/kubectl/kubectl/) 参考文档。
361359

362360
<!--
363361
## Resource types
@@ -372,7 +370,7 @@ The following table includes a list of all the supported resource types and thei
372370
<!--
373371
(This output can be retrieved from `kubectl api-resources`, and was accurate as of Kubernetes 1.25.0)
374372
-->
375-
(以下输出可以通过 `kubectl api-resources` 获取,内容以 Kubernetes 1.25.0 版本为准。)
373+
以下输出可以通过 `kubectl api-resources` 获取,内容以 Kubernetes 1.25.0 版本为准。
376374

377375
<!--
378376
| NAME | SHORTNAMES | APIVERSION | NAMESPACED | KIND |
@@ -494,8 +492,8 @@ Output format | Description
494492
------------------------------------| -----------
495493
`-o custom-columns=<spec>` | 使用逗号分隔的[自定义列](#custom-columns)列表打印表。
496494
`-o custom-columns-file=<filename>` | 使用 `<filename>` 文件中的[自定义列](#custom-columns)模板打印表。
497-
`-o json` | 输出 JSON 格式的 API 对象
498-
`-o jsonpath=<template>` | 打印 [jsonpath](/zh-cn/docs/reference/kubectl/jsonpath/) 表达式定义的字段
495+
`-o json` | 输出 JSON 格式的 API 对象
496+
`-o jsonpath=<template>` | 打印 [jsonpath](/zh-cn/docs/reference/kubectl/jsonpath/) 表达式定义的字段
499497
`-o jsonpath-file=<filename>` | 打印 `<filename>` 文件中 [jsonpath](/zh-cn/docs/reference/kubectl/jsonpath/) 表达式定义的字段。
500498
`-o kyaml` | 输出 KYAML 格式的 API 对象(Alpha 阶段,需要设置 `KUBECTL_KYAML="true"` 环境变量来启用)。
501499
`-o name` | 仅打印资源名称而不打印任何其他内容。
@@ -596,7 +594,8 @@ This allows for consistent human-readable output across clients used against the
596594
This feature is enabled by default. To disable it, add the
597595
`--server-print=false` flag to the `kubectl get` command.
598596
-->
599-
此功能默认启用。要禁用它,请将该 `--server-print=false` 参数添加到 `kubectl get` 命令中。
597+
此功能默认启用。要禁用它,请将该 `--server-print=false` 参数添加到
598+
`kubectl get` 命令中。
600599

601600
<!--
602601
##### Examples
@@ -726,10 +725,11 @@ kubectl get pods --field-selector=spec.nodeName=server01
726725
# 以纯文本输出格式列出所有 Pod。
727726
kubectl get pods
728727

729-
# 以纯文本输出格式列出所有 Pod,并包含附加信息(如节点名)
728+
# 以纯文本输出格式列出所有 Pod,并包含附加信息如节点名
730729
kubectl get pods -o wide
731730

732-
# 以纯文本输出格式列出具有指定名称的副本控制器。提示:你可以使用别名 'rc' 缩短和替换 'replicationcontroller' 资源类型。
731+
# 以纯文本输出格式列出具有指定名称的副本控制器。提示:你可以使用别名 'rc'
732+
# 缩短和替换 'replicationcontroller' 资源类型。
733733
kubectl get replicationcontroller <rc-name>
734734

735735
# 以纯文本输出格式列出所有副本控制器和 Service。
@@ -999,15 +999,18 @@ The following kubectl-compatible plugins are available:
999999
/usr/local/bin/kubectl-foo
10001000
/usr/local/bin/kubectl-bar
10011001
```
1002+
10021003
<!--
10031004
`kubectl plugin list` also warns you about plugins that are not
10041005
executable, or that are shadowed by other plugins; for example:
1006+
10051007
```shell
10061008
sudo chmod -x /usr/local/bin/kubectl-foo # remove execute permission
10071009
kubectl plugin list
10081010
```
10091011
-->
1010-
`kubectl plugin list` 指令也可以向你告警哪些插件被运行,或是被其它插件覆盖了,例如:
1012+
`kubectl plugin list` 指令也可以向你告警哪些插件被运行,
1013+
或是被其它插件覆盖了,例如:
10111014

10121015
```shell
10131016
sudo chmod -x /usr/local/bin/kubectl-foo # 删除执行权限
@@ -1053,7 +1056,7 @@ kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl
10531056
```shell
10541057
#!/bin/bash
10551058

1056-
#这个插件利用 `kubectl config` 命令基于当前所选上下文输出当前用户的信息
1059+
# 这个插件利用 `kubectl config` 命令基于当前所选上下文输出当前用户的信息
10571060
kubectl config view --template='{{ range .contexts }}{{ if eq .name "'$(kubectl config current-context)'" }}Current user: {{ printf "%s\n" .context.user }}{{ end }}{{ end }}'
10581061
```
10591062

content/zh-cn/docs/reference/node/_index.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,42 @@ This section contains the following reference topics about nodes:
2424
2525
* [Node `.status` information](/docs/reference/node/node-status/)
2626
27+
* [Linux Node Swap Behaviors](/docs/reference/node/swap-behavior/)
28+
2729
* [Seccomp information](/docs/reference/node/seccomp/)
2830
-->
2931
本部分包含以下有关节点的参考主题:
3032

31-
* Kubelet 的 [Checkpoint API](/zh-cn/docs/reference/node/kubelet-checkpoint-api/)
33+
* kubelet 的 [Checkpoint API](/zh-cn/docs/reference/node/kubelet-checkpoint-api/)
34+
3235
* 一系列[关于 dockershim 移除和使用兼容 CRI 运行时的文章](/zh-cn/docs/reference/node/topics-on-dockershim-and-cri-compatible-runtimes/)
3336

34-
* [Kubelet 设备管理器 API 版本](/zh-cn/docs/reference/node/device-plugin-api-versions)
37+
* [kubelet 设备管理器 API 版本](/zh-cn/docs/reference/node/device-plugin-api-versions)
3538

3639
* [由 kubelet 填充的节点标签](/zh-cn/docs/reference/node/node-labels)
3740

3841
* [由 kubelet 使用的本地文件和路径](/zh-cn/docs/reference/node/kubelet-files)
3942

4043
* [节点 `.status` 信息](/zh-cn/docs/reference/node/node-status/)
4144

45+
* [Linux 节点的交换(Swap)行为](/zh-cn/docs/reference/node/swap-behavior/)
46+
4247
* [Seccomp 信息](/zh-cn/docs/reference/node/seccomp/)
4348

4449
<!--
4550
You can also read node reference details from elsewhere in the
4651
Kubernetes documentation, including:
4752
4853
* [Node Metrics Data](/docs/reference/instrumentation/node-metrics).
54+
4955
* [CRI Pod & Container Metrics](/docs/reference/instrumentation/cri-pod-container-metrics).
56+
57+
* [Understand Pressure Stall Information (PSI) Metrics](/docs/reference/instrumentation/understand-psi-metrics).
5058
-->
5159
你还可以从 Kubernetes 文档的其他地方阅读节点的详细参考信息,包括:
5260

5361
* [节点指标数据](/zh-cn/docs/reference/instrumentation/node-metrics)
5462

5563
* [CRI Pod & 容器指标](/zh-cn/docs/reference/instrumentation/cri-pod-container-metrics)
64+
65+
* [了解 PSI 指标](/zh-cn/docs/reference/instrumentation/understand-psi-metrics)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
content_type: "reference"
3+
title: Linux 节点的交换(Swap)行为
4+
weight: 110
5+
---
6+
7+
<!--
8+
content_type: "reference"
9+
title: Linux Node Swap Behaviors
10+
weight: 110
11+
-->
12+
13+
<!--
14+
To allow Kubernetes workloads to use swap, on a Linux node,
15+
you must disable the kubelet's default behavior of failing when swap is detected,
16+
and specify memory-swap behavior as `LimitedSwap`:
17+
-->
18+
要允许 Kubernetes 工作负载在 Linux 节点上使用交换分区,
19+
你必须禁用 kubelet 在检测到交换分区时失败的默认行为,
20+
并指定内存交换行为为 `LimitedSwap`
21+
22+
<!--
23+
The available choices for swap behavior are:
24+
-->
25+
可用的交换行为选项有:
26+
27+
<!--
28+
`NoSwap`
29+
: (default) Workloads running as Pods on this node do not and cannot use swap. However, processes
30+
outside of Kubernetes' scope, such as system daemons (including the kubelet itself!) **can** utilize swap.
31+
This behavior is beneficial for protecting the node from system-level memory spikes,
32+
but it does not safeguard the workloads themselves from such spikes.
33+
-->
34+
`NoSwap`
35+
: (默认)在此节点上作为 Pod 运行的工作负载不会也不能使用交换分区。
36+
然而,系统守护进程(包括 kubelet 本身!)等这类 Kubernetes 范围之外的进程**可以**利用交换分区。
37+
这种行为有助于保护节点免受系统级别的内存峰值影响,
38+
但这不能保护工作负载本身不受此类峰值的影响。
39+
40+
<!--
41+
`LimitedSwap`
42+
: Kubernetes workloads can utilize swap memory. The amount of swap available to a Pod is determined automatically.
43+
44+
To learn more, read [swap memory management](/docs/concepts/cluster-administration/swap-memory-management/).
45+
-->
46+
`LimitedSwap`
47+
: Kubernetes 工作负载可以使用交换内存,Pod 可用的交换量是自动确定的。
48+
49+
要了解更多,请阅读[交换内存管理](/zh-cn/docs/concepts/cluster-administration/swap-memory-management/)

0 commit comments

Comments
 (0)