Skip to content

Commit 9cdbeca

Browse files
authored
Merge pull request #35282 from windsonsea/logyhf
[zh-cn] updated /concepts/cluster-administration/logging.md
2 parents faccca2 + 4702348 commit 9cdbeca

File tree

1 file changed

+19
-24
lines changed
  • content/zh-cn/docs/concepts/cluster-administration

1 file changed

+19
-24
lines changed

content/zh-cn/docs/concepts/cluster-administration/logging.md

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ In a cluster, logs should have a separate storage and lifecycle independent of n
2828
但是,由容器引擎或运行时提供的原生功能通常不足以构成完整的日志记录方案。
2929
例如,如果发生容器崩溃、Pod 被逐出或节点宕机等情况,你可能想访问应用日志。
3030
在集群中,日志应该具有独立的存储和生命周期,与节点、Pod 或容器的生命周期相独立。
31-
这个概念叫 _集群级的日志_
31+
这个概念叫 **集群级的日志**
3232

3333
<!-- body -->
3434

@@ -175,11 +175,11 @@ The two kubelet parameters [`containerLogMaxSize` and `containerLogMaxFiles`](/d
175175
in [kubelet config file](/docs/tasks/administer-cluster/kubelet-config-file/)
176176
can be used to configure the maximum size for each log file and the maximum number of files allowed for each container respectively.
177177
-->
178-
当使用某 *CRI 容器运行时* 时,kubelet 要负责对日志进行轮换,
179-
管理日志目录的结构。kubelet 将此信息发送给 CRI 容器运行时,后者
180-
将容器日志写入到指定的位置。[kubelet 配置文件](/docs/tasks/administer-cluster/kubelet-config-file/)
178+
当使用某 **CRI 容器运行时** 时,kubelet 要负责对日志进行轮换,并管理日志目录的结构。
179+
kubelet 将此信息发送给 CRI 容器运行时,后者将容器日志写入到指定的位置。
180+
[kubelet 配置文件](/zh-cn/docs/tasks/administer-cluster/kubelet-config-file/)
181181
中的两个 kubelet 参数
182-
[`containerLogMaxSize``containerLogMaxFiles`](/docs/reference/config-api/kubelet-config.v1beta1/#kubelet-config-k8s-io-v1beta1-KubeletConfiguration)
182+
[`containerLogMaxSize``containerLogMaxFiles`](/zh-cn/docs/reference/config-api/kubelet-config.v1beta1/#kubelet-config-k8s-io-v1beta1-KubeletConfiguration)
183183
可以用来配置每个日志文件的最大长度和每个容器可以生成的日志文件个数上限。
184184

185185
<!--
@@ -198,11 +198,10 @@ the rotation and there are two files: one file that is 10MB in size and a second
198198
`kubectl logs` returns the latest log file which in this example is an empty response.
199199
-->
200200
{{< note >}}
201-
如果有外部系统执行日志轮转或者使用了 CRI 容器运行时,那么 `kubectl logs`
201+
如果有外部系统执行日志轮转或者使用了 CRI 容器运行时,那么 `kubectl logs`
202202
仅可查询到最新的日志内容。
203203
比如,对于一个 10MB 大小的文件,通过 `logrotate` 执行轮转后生成两个文件,
204-
一个 10MB 大小,一个为空,`kubectl logs` 返回最新的日志文件,而该日志文件
205-
在这个例子中为空。
204+
一个 10MB 大小,一个为空,`kubectl logs` 返回最新的日志文件,而该日志文件在这个例子中为空。
206205
{{< /note >}}
207206

208207
<!--
@@ -278,7 +277,7 @@ While Kubernetes does not provide a native solution for cluster-level logging, t
278277
<!--
279278
You can implement cluster-level logging by including a _node-level logging agent_ on each node. The logging agent is a dedicated tool that exposes logs or pushes logs to a backend. Commonly, the logging agent is a container that has access to a directory with log files from all of the application containers on that node.
280279
-->
281-
你可以通过在每个节点上使用 _节点级的日志记录代理_ 来实现集群级日志记录。
280+
你可以通过在每个节点上使用 **节点级的日志记录代理** 来实现集群级日志记录。
282281
日志记录代理是一种用于暴露日志或将日志推送到后端的专用工具。
283282
通常,日志记录代理程序是一个容器,它可以访问包含该节点上所有应用程序容器的日志文件的目录。
284283

@@ -294,8 +293,7 @@ Node-level logging creates only one agent per node, and doesn't require any chan
294293
Containers write to stdout and stderr, but with no agreed format. A node-level agent collects these logs and forwards them for aggregation.
295294
-->
296295
容器向标准输出和标准错误输出写出数据,但在格式上并不统一。
297-
节点级代理
298-
收集这些日志并将其进行转发以完成汇总。
296+
节点级代理收集这些日志并将其进行转发以完成汇总。
299297

300298
<!--
301299
### Using a sidecar container with the logging agent {#sidecar-container-with-logging-agent}
@@ -342,15 +340,15 @@ like `kubectl logs`.
342340
-->
343341
这种方法允许你将日志流从应用程序的不同部分分离开,其中一些可能缺乏对写入
344342
`stdout``stderr` 的支持。重定向日志背后的逻辑是最小的,因此它的开销几乎可以忽略不计。
345-
另外,因为 `stdout``stderr` 由 kubelet 处理,你可以使用内置的工具 `kubectl logs`
343+
另外,因为 `stdout``stderr` 由 kubelet 处理,所以你可以使用内置的工具 `kubectl logs`
346344

347345
<!--
348346
For example, a pod runs a single container, and the container
349347
writes to two different log files, using two different formats. Here's a
350348
configuration file for the Pod:
351349
-->
352350
例如,某 Pod 中运行一个容器,该容器向两个文件写不同格式的日志。
353-
下面是这个 pod 的配置文件:
351+
下面是这个 Pod 的配置文件:
354352

355353
{{< codenew file="admin/logging/two-files-counter-pod.yaml" >}}
356354

@@ -361,9 +359,9 @@ the container. Instead, you can create two sidecar containers. Each sidecar
361359
container could tail a particular log file from a shared volume and then redirect
362360
the logs to its own `stdout` stream.
363361
-->
364-
不建议在同一个日志流中写入不同格式的日志条目,即使你成功地将其重定向到容器的
365-
`stdout` 流。相反,你可以创建两个边车容器。每个边车容器可以从共享卷
366-
跟踪特定的日志文件,并将文件内容重定向到各自的 `stdout` 流。
362+
不建议在同一个日志流中写入不同格式的日志条目,即使你成功地将其重定向到容器的 `stdout` 流。
363+
相反,你可以创建两个边车容器。每个边车容器可以从共享卷跟踪特定的日志文件,
364+
并将文件内容重定向到各自的 `stdout` 流。
367365

368366
<!--
369367
Here's a configuration file for a pod that has two sidecar containers:
@@ -439,8 +437,7 @@ and retention policies to the kubelet.
439437
-->
440438
应用本身如果不具备轮转日志文件的功能,可以通过边车容器实现。
441439
该方式的一个例子是运行一个小的、定期轮转日志的容器。
442-
然而,还是推荐直接使用 `stdout``stderr`,将日志的轮转和保留策略
443-
交给 kubelet。
440+
然而,还是推荐直接使用 `stdout``stderr`,将日志的轮转和保留策略交给 kubelet。
444441

445442
<!--
446443
#### Sidecar container with a logging agent
@@ -456,8 +453,8 @@ If the node-level logging agent is not flexible enough for your situation, you
456453
can create a sidecar container with a separate logging agent that you have
457454
configured specifically to run with your application.
458455
-->
459-
如果节点级日志记录代理程序对于你的场景来说不够灵活,你可以创建一个
460-
带有单独日志记录代理的边车容器,将代理程序专门配置为与你的应用程序一起运行。
456+
如果节点级日志记录代理程序对于你的场景来说不够灵活,
457+
你可以创建一个带有单独日志记录代理的边车容器,将代理程序专门配置为与你的应用程序一起运行。
461458

462459
{{< note >}}
463460
<!--
@@ -499,8 +496,7 @@ flutend 通过 Pod 的挂载卷获取它的配置数据。
499496
<!--
500497
In the sample configurations, you can replace fluentd with any logging agent, reading from any source inside an application container.
501498
-->
502-
在示例配置中,你可以将 fluentd 替换为任何日志代理,从应用容器内
503-
的任何来源读取数据。
499+
在示例配置中,你可以将 fluentd 替换为任何日志代理,从应用容器内的任何来源读取数据。
504500

505501
<!--
506502
### Exposing logs directly from the application
@@ -514,6 +510,5 @@ In the sample configurations, you can replace fluentd with any logging agent, re
514510
<!--
515511
Cluster-logging that exposes or pushes logs directly from every application is outside the scope of Kubernetes.
516512
-->
517-
从各个应用中直接暴露和推送日志数据的集群日志机制
518-
已超出 Kubernetes 的范围。
513+
从各个应用中直接暴露和推送日志数据的集群日志机制已超出 Kubernetes 的范围。
519514

0 commit comments

Comments
 (0)