@@ -3,7 +3,6 @@ title: 垃圾收集
3
3
content_type : concept
4
4
weight : 70
5
5
---
6
-
7
6
<!--
8
7
title: Garbage Collection
9
8
content_type: concept
@@ -105,7 +104,7 @@ You can check for that kind of Event by running
105
104
-->
106
105
在 1.20 及更高版本中,如果垃圾收集器检测到非法的跨名字空间 ` ownerReference ` ,
107
106
或者某集群作用域的依赖对象的 ` ownerReference ` 引用某名字空间作用域的类别,
108
- 系统会生成一个警告事件,其原因为 ` OwnerRefInvalidNamespace ` , ` involvedObject `
107
+ 系统会生成一个警告事件,其原因为 ` OwnerRefInvalidNamespace ` 和 ` involvedObject `
109
108
设置为非法的依赖对象。你可以通过运行
110
109
` kubectl get events -A --field-selector=reason=OwnerRefInvalidNamespace `
111
110
来检查是否存在这类事件。
@@ -201,8 +200,7 @@ to learn more.
201
200
默认情况下,Kubernetes 使用后台级联删除方案,除非你手动设置了要使用前台删除,
202
201
或者选择遗弃依赖对象。
203
202
204
- 参阅[ 使用后台级联删除] ( /zh-cn/docs/tasks/administer-cluster/use-cascading-deletion/#use-background-cascading-deletion )
205
- 以了解进一步的细节。
203
+ 参阅[ 使用后台级联删除] ( /zh-cn/docs/tasks/administer-cluster/use-cascading-deletion/#use-background-cascading-deletion ) 以了解进一步的细节。
206
204
207
205
<!--
208
206
### Orphaned dependents
@@ -214,8 +212,8 @@ to override this behaviour, see [Delete owner objects and orphan dependents](/do
214
212
### 被遗弃的依赖对象 {#orphaned-dependents}
215
213
216
214
当 Kubernetes 删除某个属主对象时,被留下来的依赖对象被称作被遗弃的(Orphaned)对象。
217
- 默认情况下,Kubernetes 会删除依赖对象。要了解如何重载这种默认行为,可参阅
218
- [ 删除属主对象和遗弃依赖对象] ( /zh-cn/docs/tasks/administer-cluster/use-cascading-deletion/#set-orphan-deletion-policy ) 。
215
+ 默认情况下,Kubernetes 会删除依赖对象。要了解如何重载这种默认行为,
216
+ 可参阅 [ 删除属主对象和遗弃依赖对象] ( /zh-cn/docs/tasks/administer-cluster/use-cascading-deletion/#set-orphan-deletion-policy ) 。
219
217
220
218
<!--
221
219
## Garbage collection of unused containers and images {#containers-images}
@@ -239,8 +237,8 @@ and change the parameters related to garbage collection using the
239
237
[`KubeletConfiguration`](/docs/reference/config-api/kubelet-config.v1beta1/)
240
238
resource type.
241
239
-->
242
- 要配置对未使用容器和镜像的垃圾收集选项,可以使用一个
243
- [ 配置文件] ( /zh-cn/docs/tasks/administer-cluster/kubelet-config-file/ ) ,基于
240
+ 要配置对未使用容器和镜像的垃圾收集选项,
241
+ 可以使用一个 [ 配置文件] ( /zh-cn/docs/tasks/administer-cluster/kubelet-config-file/ ) ,基于
244
242
[ ` KubeletConfiguration ` ] ( /zh-cn/docs/reference/config-api/kubelet-config.v1beta1/ )
245
243
资源类型来调整与垃圾收集相关的 kubelet 行为。
246
244
@@ -292,16 +290,35 @@ To configure the setting, enable the `ImageMaximumGCAge`
292
290
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) for the kubelet,
293
291
and also set a value for the `ImageMaximumGCAge` field in the kubelet configuration file.
294
292
-->
295
- 请为 kubelet 启用 ` ImageMaximumGCAge `
293
+ 请为 kubelet 启用 ` ImageMaximumGCAge `
296
294
[ 特性门控] ( /zh-cn/docs/reference/command-line-tools-reference/feature-gates/ ) ,
297
295
并在 kubelet 配置文件中为 ` ImageMaximumGCAge ` 字段赋值来配置该设置。
298
296
299
297
<!--
300
- The value is specified as a Kubernetes _duration_; for example, you can set the configuration
301
- field to `3d12h`, which means 3 days and 12 hours.
298
+ The value is specified as a Kubernetes _duration_;
299
+ Valid time units for the `ImageMaximumGCAge` field in the kubelet configuration file are:
300
+ - "ns" for nanoseconds
301
+ - "us" or "µs" for microseconds
302
+ - "ms" for milliseconds
303
+ - "s" for seconds
304
+ - "m" for minutes
305
+ - "h" for hours
306
+ -->
307
+ 该值应遵循 Kubernetes ** 持续时间(Duration)** 格式;
308
+ 在 kubelet 配置文件中,` ImageMaximumGCAge ` 字段的有效时间单位如下:
309
+
310
+ - "ns" 表示纳秒
311
+ - "us" 或 "µs" 表示微秒
312
+ - "ms" 表示毫秒
313
+ - "s" 表示秒
314
+ - "m" 表示分钟
315
+ - "h" 表示小时
316
+
317
+ <!--
318
+ For example, you can set the configuration field to `12h45m`,
319
+ which means 12 hours and 45 minutes.
302
320
-->
303
- 该值应遵循 Kubernetes __ 持续时间(Duration)__ 格式;例如,你可以将配置字段设置为 ` 3d12h ` ,
304
- 代表 3 天 12 小时。
321
+ 例如,你可以将配置字段设置为 ` 12h45m ` ,代表 12 小时 45 分钟。
305
322
306
323
{{< note >}}
307
324
<!--
0 commit comments