@@ -6,7 +6,6 @@ api_metadata:
66content_type : concept
77weight : 20
88---
9-
109<!--
1110reviewers:
1211- derekwaynecarr
@@ -54,7 +53,7 @@ Resource quotas work like this:
5453 tracks usage to ensure it does not exceed hard resource limits defined in a ResourceQuota.
5554- If creating or updating a resource violates a quota constraint, the request will fail with HTTP
5655 status code `403 FORBIDDEN` with a message explaining the constraint that would have been violated.
57- - If quota is enabled in a namespace for compute resources like `cpu` and `memory`, users must specify
56+ - If quotas are enabled in a namespace for compute resources like `cpu` and `memory`, users must specify
5857 requests or limits for those values; otherwise, the quota system may reject pod creation. Hint: Use
5958 the `LimitRanger` admission controller to force defaults for pods that make no compute resource requirements.
6059
@@ -405,9 +404,9 @@ exhausts the cluster's supply of Pod IPs.
405404从而耗尽集群所能提供的 Pod IP 地址。
406405
407406<!--
408- 您可以在[查看和设置配额 ](#viewing-and-setting-quotas) 上找到更多示例。
407+ You can find more examples on [Viewing and Setting Quotas ](#viewing-and-setting-quotas).
409408-->
410- 你可以在[ 查看和设置配额] ( #viewing-and-setting-quotas ) 节查看更多示例 。
409+ 你可以在[ 查看和设置配额] ( #viewing-and-setting-quotas ) 一节查看更多示例 。
411410
412411<!--
413412## Quota Scopes
@@ -429,9 +428,9 @@ Resources specified on the quota outside of the allowed set results in a validat
429428
430429<!--
431430| Scope | Description |
432- | ----- | ------------ |
433- | `Terminating` | Match pods where `.spec.activeDeadlineSeconds >= 0` |
434- | `NotTerminating` | Match pods where `.spec.activeDeadlineSeconds is nil` |
431+ | ----- | ----------- |
432+ | `Terminating` | Match pods where `.spec.activeDeadlineSeconds` >= ` 0` |
433+ | `NotTerminating` | Match pods where `.spec.activeDeadlineSeconds` is ` nil` |
435434| `BestEffort` | Match pods that have best effort quality of service. |
436435| `NotBestEffort` | Match pods that do not have best effort quality of service. |
437436| `PriorityClass` | Match pods that references the specified [priority class](/docs/concepts/scheduling-eviction/pod-priority-preemption). |
@@ -538,7 +537,7 @@ Pod 可以创建为特定的[优先级](/zh-cn/docs/concepts/scheduling-eviction
538537<!--
539538A quota is matched and consumed only if `scopeSelector` in the quota spec selects the pod.
540539-->
541- 仅当配额规范中的 `scopeSelector` 字段选择到某 Pod 时,配额机制才会匹配和计量 Pod 的资源消耗。
540+ 仅当配额规约中的 `scopeSelector` 字段选择到某 Pod 时,配额机制才会匹配和计量 Pod 的资源消耗。
542541
543542<!--
544543When quota is scoped for priority class using `scopeSelector` field, quota object
@@ -572,65 +571,19 @@ works as follows:
572571- 为每个优先级创建一个配额对象。
573572
574573<!--
575- Save the following YAML to a file `quota.yml `.
574+ Save the following YAML to a file `quota.yaml `.
576575-->
577- 将以下 YAML 保存到文件 `quota.yml ` 中。
576+ 将以下 YAML 保存到文件 `quota.yaml ` 中。
578577
579- ` ` ` yaml
580- apiVersion: v1
581- kind: List
582- items:
583- - apiVersion: v1
584- kind: ResourceQuota
585- metadata:
586- name: pods-high
587- spec:
588- hard:
589- cpu: "1000"
590- memory: 200Gi
591- pods: "10"
592- scopeSelector:
593- matchExpressions:
594- - operator: In
595- scopeName: PriorityClass
596- values: ["high"]
597- - apiVersion: v1
598- kind: ResourceQuota
599- metadata:
600- name: pods-medium
601- spec:
602- hard:
603- cpu: "10"
604- memory: 20Gi
605- pods: "10"
606- scopeSelector:
607- matchExpressions:
608- - operator: In
609- scopeName: PriorityClass
610- values: ["medium"]
611- - apiVersion: v1
612- kind: ResourceQuota
613- metadata:
614- name: pods-low
615- spec:
616- hard:
617- cpu: "5"
618- memory: 10Gi
619- pods: "10"
620- scopeSelector:
621- matchExpressions:
622- - operator: In
623- scopeName: PriorityClass
624- values: ["low"]
625- ` ` `
578+ {{% code_sample file="policy/quota.yaml" %}}
626579
627580<!--
628581Apply the YAML using `kubectl create`.
629582-->
630583使用 `kubectl create` 命令运行以下操作。
631584
632585` ` ` shell
633- kubectl create -f ./quota.yml
586+ kubectl create -f ./quota.yaml
634587` ` `
635588
636589```
@@ -678,39 +631,20 @@ pods 0 10
678631
679632<!--
680633Create a pod with priority "high". Save the following YAML to a
681- file `high-priority-pod.yml `.
634+ file `high-priority-pod.yaml `.
682635-->
683636创建优先级为 "high" 的 Pod。
684- 将以下 YAML 保存到文件 ` high-priority-pod.yml ` 中。
637+ 将以下 YAML 保存到文件 ` high-priority-pod.yaml ` 中。
685638
686- ``` yaml
687- apiVersion : v1
688- kind : Pod
689- metadata :
690- name : high-priority
691- spec :
692- containers :
693- - name : high-priority
694- image : ubuntu
695- command : ["/bin/sh"]
696- args : ["-c", "while true; do echo hello; sleep 10;done"]
697- resources :
698- requests :
699- memory : " 10Gi"
700- cpu : " 500m"
701- limits :
702- memory : " 10Gi"
703- cpu : " 500m"
704- priorityClassName : high
705- ` ` `
639+ {{% code_sample file="policy/high-priority-pod.yaml" %}}
706640
707641<!--
708642Apply it with `kubectl create`.
709643-->
710644使用 ` kubectl create ` 运行以下操作。
711645
712646``` shell
713- kubectl create -f ./high-priority-pod.yml
647+ kubectl create -f ./high-priority-pod.yaml
714648```
715649
716650<!--
@@ -877,9 +811,9 @@ metadata:
877811spec:
878812 hard:
879813 requests.cpu: "1"
880- requests.memory: 1Gi
814+ requests.memory: " 1Gi"
881815 limits.cpu: "2"
882- limits.memory: 2Gi
816+ limits.memory: " 2Gi"
883817 requests.nvidia.com/gpu: 4
884818EOF
885819` ` `
0 commit comments