@@ -36,7 +36,7 @@ Resource quotas work like this:
3636- If creating or updating a resource violates a quota constraint, the request will fail with HTTP
3737 status code ` 403 FORBIDDEN ` with a message explaining the constraint that would have been violated.
3838
39- - If quota is enabled in a namespace for compute resources like ` cpu ` and ` memory ` , users must specify
39+ - If quotas are enabled in a namespace for compute resources like ` cpu ` and ` memory ` , users must specify
4040 requests or limits for those values; otherwise, the quota system may reject pod creation. Hint: Use
4141 the ` LimitRanger ` admission controller to force defaults for pods that make no compute resource requirements.
4242
@@ -222,8 +222,8 @@ Resources specified on the quota outside of the allowed set results in a validat
222222
223223| Scope | Description |
224224| ----- | ----------- |
225- | ` Terminating ` | Match pods where ` .spec.activeDeadlineSeconds >= 0 ` |
226- | ` NotTerminating ` | Match pods where ` .spec.activeDeadlineSeconds is nil ` |
225+ | ` Terminating ` | Match pods where ` .spec.activeDeadlineSeconds ` >= ` 0 ` |
226+ | ` NotTerminating ` | Match pods where ` .spec.activeDeadlineSeconds ` is ` nil ` |
227227| ` BestEffort ` | Match pods that have best effort quality of service. |
228228| ` NotBestEffort ` | Match pods that do not have best effort quality of service. |
229229| ` PriorityClass ` | Match pods that references the specified [ priority class] ( /docs/concepts/scheduling-eviction/pod-priority-preemption ) . |
@@ -308,60 +308,14 @@ works as follows:
308308- Pods in the cluster have one of the three priority classes, "low", "medium", "high".
309309- One quota object is created for each priority.
310310
311- Save the following YAML to a file `quota.yml `.
311+ Save the following YAML to a file `quota.yaml `.
312312
313- ` ` ` yaml
314- apiVersion: v1
315- kind: List
316- items:
317- - apiVersion: v1
318- kind: ResourceQuota
319- metadata:
320- name: pods-high
321- spec:
322- hard:
323- cpu: "1000"
324- memory: 200Gi
325- pods: "10"
326- scopeSelector:
327- matchExpressions:
328- - operator : In
329- scopeName: PriorityClass
330- values: ["high"]
331- - apiVersion: v1
332- kind: ResourceQuota
333- metadata:
334- name: pods-medium
335- spec:
336- hard:
337- cpu: "10"
338- memory: 20Gi
339- pods: "10"
340- scopeSelector:
341- matchExpressions:
342- - operator : In
343- scopeName: PriorityClass
344- values: ["medium"]
345- - apiVersion: v1
346- kind: ResourceQuota
347- metadata:
348- name: pods-low
349- spec:
350- hard:
351- cpu: "5"
352- memory: 10Gi
353- pods: "10"
354- scopeSelector:
355- matchExpressions:
356- - operator : In
357- scopeName: PriorityClass
358- values: ["low"]
359- ` ` `
313+ {{% code_sample file="policy/quota.yaml" %}}
360314
361315Apply the YAML using `kubectl create`.
362316
363317` ` ` shell
364- kubectl create -f ./quota.yml
318+ kubectl create -f ./quota.yaml
365319` ` `
366320
367321```
@@ -405,33 +359,14 @@ pods 0 10
405359```
406360
407361Create a pod with priority "high". Save the following YAML to a
408- file ` high-priority-pod.yml ` .
362+ file ` high-priority-pod.yaml ` .
409363
410- ``` yaml
411- apiVersion : v1
412- kind : Pod
413- metadata :
414- name : high-priority
415- spec :
416- containers :
417- - name : high-priority
418- image : ubuntu
419- command : ["/bin/sh"]
420- args : ["-c", "while true; do echo hello; sleep 10;done"]
421- resources :
422- requests :
423- memory : " 10Gi"
424- cpu : " 500m"
425- limits :
426- memory : " 10Gi"
427- cpu : " 500m"
428- priorityClassName : high
429- ` ` `
364+ {{% code_sample file="policy/high-priority-pod.yaml" %}}
430365
431366Apply it with ` kubectl create ` .
432367
433368``` shell
434- kubectl create -f ./high-priority-pod.yml
369+ kubectl create -f ./high-priority-pod.yaml
435370```
436371
437372Verify that "Used" stats for "high" priority quota, ` pods-high ` , has changed and that
@@ -550,9 +485,9 @@ metadata:
550485spec:
551486 hard:
552487 requests.cpu: "1"
553- requests.memory: 1Gi
488+ requests.memory: " 1Gi"
554489 limits.cpu: "2"
555- limits.memory: 2Gi
490+ limits.memory: " 2Gi"
556491 requests.nvidia.com/gpu: 4
557492EOF
558493` ` `
0 commit comments