@@ -60,14 +60,14 @@ Resource quotas work like this:
60
60
See the [walkthrough](/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/)
61
61
for an example of how to avoid this problem.
62
62
-->
63
- - 不同的团队可以在不同的命名空间下工作。 这可以通过
63
+ - 不同的团队可以在不同的命名空间下工作, 这可以通过
64
64
[ RBAC] ( /zh-cn/docs/reference/access-authn-authz/rbac/ ) 强制执行。
65
65
- 集群管理员可以为每个命名空间创建一个或多个 ResourceQuota 对象。
66
66
- 当用户在命名空间下创建资源(如 Pod、Service 等)时,Kubernetes 的配额系统会跟踪集群的资源使用情况,
67
67
以确保使用的资源用量不超过 ResourceQuota 中定义的硬性资源限额。
68
68
- 如果资源创建或者更新请求违反了配额约束,那么该请求会报错(HTTP 403 FORBIDDEN),
69
69
并在消息中给出有可能违反的约束。
70
- - 如果命名空间下的计算资源 (如 ` cpu ` 和 ` memory ` )的配额被启用,
70
+ - 如果命名空间下的计算资源(如 ` cpu ` 和 ` memory ` )的配额被启用,
71
71
则用户必须为这些资源设定请求值(request)和约束值(limit),否则配额系统将拒绝 Pod 的创建。
72
72
提示: 可使用 ` LimitRanger ` 准入控制器来为没有设置计算资源需求的 Pod 设置默认值。
73
73
@@ -195,8 +195,8 @@ In addition to the resources mentioned above, in release 1.10, quota support for
195
195
-->
196
196
### 扩展资源的资源配额 {#resource-quota-for-extended-resources}
197
197
198
- 除上述资源外,在 Kubernetes 1.10 版本中,还添加了对
199
- [ 扩展资源] ( /zh-cn/docs/concepts/configuration/manage-resources-containers/#extended-resources )
198
+ 除上述资源外,在 Kubernetes 1.10 版本中,
199
+ 还添加了对 [ 扩展资源] ( /zh-cn/docs/concepts/configuration/manage-resources-containers/#extended-resources )
200
200
的支持。
201
201
202
202
<!--
@@ -248,7 +248,7 @@ In addition, you can limit consumption of storage resources based on associated
248
248
| ` requests.storage ` | 所有 PVC,存储资源的需求总量不能超过该值。 |
249
249
| ` persistentvolumeclaims ` | 在该命名空间中所允许的 [ PVC] ( /zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims ) 总量。 |
250
250
| ` <storage-class-name>.storageclass.storage.k8s.io/requests.storage ` | 在所有与 ` <storage-class-name> ` 相关的持久卷申领中,存储请求的总和不能超过该值。 |
251
- | ` <storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims ` | 在与 storage-class-name 相关的所有持久卷申领中,命名空间中可以存在的[ 持久卷申领] ( /zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims ) 总数。 |
251
+ | ` <storage-class-name>.storageclass.storage.k8s.io/persistentvolumeclaims ` | 在与 storage-class-name 相关的所有持久卷申领中,命名空间中可以存在的[ 持久卷申领] ( /zh-cn/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims ) 总数。 |
252
252
253
253
<!--
254
254
For example, if an operator wants to quota storage with `gold` storage class separate from `bronze` storage class, the operator can
@@ -284,32 +284,31 @@ When using a CRI container runtime, container logs will count against the epheme
284
284
This can result in the unexpected eviction of pods that have exhausted their storage quotas.
285
285
Refer to [Logging Architecture](/docs/concepts/cluster-administration/logging/) for details.
286
286
-->
287
- 如果所使用的是 CRI 容器运行时,容器日志会被计入临时存储配额。
288
- 这可能会导致存储配额耗尽的 Pods 被意外地驱逐出节点。
289
- 参考[ 日志架构] ( /zh-cn/docs/concepts/cluster-administration/logging/ )
290
- 了解详细信息。
287
+ 如果所使用的是 CRI 容器运行时,容器日志会被计入临时存储配额,
288
+ 这可能会导致存储配额耗尽的 Pod 被意外地驱逐出节点。
289
+ 参考[ 日志架构] ( /zh-cn/docs/concepts/cluster-administration/logging/ ) 了解详细信息。
291
290
{{< /note >}}
292
291
293
292
<!--
294
293
## Object Count Quota
295
294
296
- You can set quota for the total number of certain resources of all standard ,
297
- namespaced resource types using the following syntax:
295
+ You can set quota for * the total number of one particular resource kind* in the Kubernetes API ,
296
+ using the following syntax:
298
297
299
298
* `count/<resource>.<group>` for resources from non-core groups
300
299
* `count/<resource>` for resources from the core group
301
300
-->
302
301
## 对象数量配额 {#object-count-quota}
303
302
304
- 你可以使用以下语法对所有标准的、命名空间域的资源类型进行配额设置 :
303
+ 你可以使用以下语法为 Kubernetes API 中“一种特定资源类型的总数”设置配额 :
305
304
306
305
* ` count/<resource>.<group> ` :用于非核心(core)组的资源
307
306
* ` count/<resource> ` :用于核心组的资源
308
307
309
308
<!--
310
309
Here is an example set of resources users may want to put under object count quota:
311
310
-->
312
- 这是用户可能希望利用对象计数配额来管理的一组资源示例。
311
+ 这是用户可能希望利用对象计数配额来管理的一组资源示例:
313
312
314
313
* ` count/persistentvolumeclaims `
315
314
* ` count/services `
@@ -323,32 +322,42 @@ Here is an example set of resources users may want to put under object count quo
323
322
* ` count/cronjobs.batch `
324
323
325
324
<!--
326
- The same syntax can be used for custom resources.
325
+ If you define a quota this way, it applies to Kubernetes' APIs that are part of the API server, and
326
+ to any custom resources backed by a CustomResourceDefinition. If you use [API aggregation](/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/) to
327
+ add additional, custom APIs that are not defined as CustomResourceDefinitions, the core Kubernetes
328
+ control plane does not enforce quota for the aggregated API. The extension API server is expected to
329
+ provide quota enforcement if that's appropriate for the custom API.
327
330
For example, to create a quota on a `widgets` custom resource in the `example.com` API group, use `count/widgets.example.com`.
328
331
-->
329
- 相同语法也可用于自定义资源。
332
+ 如果你以这种方式定义配额,它将应用于属于 API 服务器一部分的 Kubernetes API,以及 CustomResourceDefinition
333
+ 支持的任何自定义资源。
334
+ 如果你使用[ 聚合 API] ( /zh-cn/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/ )
335
+ 添加未定义为 CustomResourceDefinitions 的其他自定义 API,则核心 Kubernetes 控制平面不会对聚合 API 实施配额管理。
336
+ 如果合适,扩展 API 服务器需要为自定义 API 提供配额管理。
330
337
例如,要对 ` example.com ` API 组中的自定义资源 ` widgets ` 设置配额,请使用
331
338
` count/widgets.example.com ` 。
332
339
333
340
<!--
334
- When using `count/*` resource quota, an object is charged against the quota if it exists in server storage.
341
+ When using such a resource quota (nearly for all object kinds), an object is charged
342
+ against the quota if the object kind exists (is defined) in the control plane.
335
343
These types of quotas are useful to protect against exhaustion of storage resources. For example, you may
336
344
want to limit the number of Secrets in a server given their large size. Too many Secrets in a cluster can
337
345
actually prevent servers and controllers from starting. You can set a quota for Jobs to protect against
338
346
a poorly configured CronJob. CronJobs that create too many Jobs in a namespace can lead to a denial of service.
339
347
-->
340
- 当使用 ` count/* ` 资源配额时,如果对象存在于服务器存储中,则会根据配额管理资源。
348
+ 当使用这样的资源配额(几乎涵盖所有对象类别)时,如果对象类别在控制平面中已存在(已定义),
349
+ 则该对象管理会参考配额设置。
341
350
这些类型的配额有助于防止存储资源耗尽。例如,用户可能想根据服务器的存储能力来对服务器中
342
351
Secret 的数量进行配额限制。
343
352
集群中存在过多的 Secret 实际上会导致服务器和控制器无法启动。
344
353
用户可以选择对 Job 进行配额管理,以防止配置不当的 CronJob 在某命名空间中创建太多
345
354
Job 而导致集群拒绝服务。
346
355
347
356
<!--
348
- It is also possible to do generic object count quota on a limited set of resources.
357
+ There is another syntax only to set the same type of quota for certain resources.
349
358
The following types are supported:
350
359
-->
351
- 对有限的一组资源上实施一般性的对象数量配额也是可能的 。
360
+ 还有另一种语法仅用于为某些资源设置相同类型的配额 。
352
361
353
362
支持以下类型:
354
363
@@ -383,10 +392,15 @@ created in a single namespace that are not terminal. You might want to set a `po
383
392
quota on a namespace to avoid the case where a user creates many small pods and
384
393
exhausts the cluster's supply of Pod IPs.
385
394
-->
386
- 例如,` pods ` 配额统计某个命名空间中所创建的、非终止状态的 ` Pod ` 个数并确保其不超过某上限值。
395
+ 例如,` pods ` 配额统计某个命名空间中所创建的、非终止状态的 ` pods ` 个数并确保其不超过某上限值。
387
396
用户可能希望在某命名空间中设置 ` pods ` 配额,以避免有用户创建很多小的 Pod,
388
397
从而耗尽集群所能提供的 Pod IP 地址。
389
398
399
+ <!--
400
+ 您可以在[查看和设置配额](#viewing-and-setting-quotas) 上找到更多示例。
401
+ -->
402
+ 你可以在[ 查看和设置配额] ( #viewing-and-setting-quotas ) 节查看更多示例。
403
+
390
404
<!--
391
405
## Quota Scopes
392
406
@@ -421,8 +435,8 @@ Resources specified on the quota outside of the allowed set results in a validat
421
435
| ` NotTerminating ` | 匹配所有 ` spec.activeDeadlineSeconds ` 是 nil 的 Pod。 |
422
436
| ` BestEffort ` | 匹配所有 Qos 是 BestEffort 的 Pod。 |
423
437
| ` NotBestEffort ` | 匹配所有 Qos 不是 BestEffort 的 Pod。 |
424
- | ` PriorityClass ` | 匹配所有引用了所指定的[ 优先级类] ( /zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption ) 的 Pods 。 |
425
- | ` CrossNamespacePodAffinity ` | 匹配那些设置了跨名字空间 [ (反)亲和性条件] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node ) 的 Pod。 |
438
+ | ` PriorityClass ` | 匹配所有引用了所指定的[ 优先级类] ( /zh-cn/docs/concepts/scheduling-eviction/pod-priority-preemption ) 的 Pod 。 |
439
+ | ` CrossNamespacePodAffinity ` | 匹配那些设置了跨名字空间[ (反)亲和性条件] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node ) 的 Pod。 |
426
440
427
441
<!--
428
442
The `BestEffort` scope restricts a quota to tracking the following resource:
@@ -540,8 +554,7 @@ is restricted to track only following resources:
540
554
This example creates a quota object and matches it with pods at specific priorities. The example
541
555
works as follows :
542
556
-->
543
- 本示例创建一个配额对象,并将其与具有特定优先级的 Pod 进行匹配。
544
- 该示例的工作方式如下:
557
+ 本示例创建一个配额对象,并将其与具有特定优先级的 Pod 进行匹配,其工作方式如下:
545
558
546
559
<!--
547
560
- Pods in the cluster have one of the three priority classes, "low", "medium", "high".
@@ -786,7 +799,7 @@ as a limited resource by setting the kube-apiserver flag --admission-control-con
786
799
to the path of the following configuration file:
787
800
-->
788
801
如果集群运维人员希望默认禁止使用 ` namespaces ` 和 ` namespaceSelector ` ,
789
- 而仅仅允许在特定名字空间中这样做 ,他们可以将 ` CrossNamespacePodAffinity `
802
+ 而仅仅允许在特定命名空间中这样做 ,他们可以将 ` CrossNamespacePodAffinity `
790
803
作为一个被约束的资源。方法是为 ` kube-apiserver ` 设置标志
791
804
` --admission-control-config-file ` ,使之指向如下的配置文件:
792
805
@@ -839,9 +852,9 @@ then it requires that every incoming container specifies an explicit limit for t
839
852
840
853
Kubectl supports creating, updating, and viewing quotas :
841
854
-->
842
- # # 查看和设置配额 {#viewing-and-setting-quotas}
855
+ # # 查看和设置配额 {#viewing-and-setting-quotas}
843
856
844
- Kubectl 支持创建、更新和查看配额:
857
+ kubectl 支持创建、更新和查看配额:
845
858
846
859
` ` ` shell
847
860
kubectl create namespace myspace
@@ -976,7 +989,7 @@ automatically give each namespace the ability to consume more resources.
976
989
## 配额和集群容量 {#quota-and-cluster-capacity}
977
990
978
991
ResourceQuota 与集群资源总量是完全独立的。它们通过绝对的单位来配置。
979
- 所以,为集群添加节点时,资源配额*不会 *自动赋予每个命名空间消耗更多资源的能力。
992
+ 所以,为集群添加节点时,资源配额**不会* *自动赋予每个命名空间消耗更多资源的能力。
980
993
981
994
<!--
982
995
Sometimes more complex policies may be desired, such as:
0 commit comments