@@ -36,7 +36,7 @@ Resource quotas work like this:
36
36
- If creating or updating a resource violates a quota constraint, the request will fail with HTTP
37
37
status code ` 403 FORBIDDEN ` with a message explaining the constraint that would have been violated.
38
38
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
40
40
requests or limits for those values; otherwise, the quota system may reject pod creation. Hint: Use
41
41
the ` LimitRanger ` admission controller to force defaults for pods that make no compute resource requirements.
42
42
@@ -222,8 +222,8 @@ Resources specified on the quota outside of the allowed set results in a validat
222
222
223
223
| Scope | Description |
224
224
| ----- | ----------- |
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 ` |
227
227
| ` BestEffort ` | Match pods that have best effort quality of service. |
228
228
| ` NotBestEffort ` | Match pods that do not have best effort quality of service. |
229
229
| ` PriorityClass ` | Match pods that references the specified [ priority class] ( /docs/concepts/scheduling-eviction/pod-priority-preemption ) . |
@@ -308,60 +308,14 @@ works as follows:
308
308
- Pods in the cluster have one of the three priority classes, "low", "medium", "high".
309
309
- One quota object is created for each priority.
310
310
311
- Save the following YAML to a file `quota.yml `.
311
+ Save the following YAML to a file `quota.yaml `.
312
312
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" %}}
360
314
361
315
Apply the YAML using `kubectl create`.
362
316
363
317
` ` ` shell
364
- kubectl create -f ./quota.yml
318
+ kubectl create -f ./quota.yaml
365
319
` ` `
366
320
367
321
```
@@ -405,33 +359,14 @@ pods 0 10
405
359
```
406
360
407
361
Create a pod with priority "high". Save the following YAML to a
408
- file ` high-priority-pod.yml ` .
362
+ file ` high-priority-pod.yaml ` .
409
363
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" %}}
430
365
431
366
Apply it with ` kubectl create ` .
432
367
433
368
``` shell
434
- kubectl create -f ./high-priority-pod.yml
369
+ kubectl create -f ./high-priority-pod.yaml
435
370
```
436
371
437
372
Verify that "Used" stats for "high" priority quota, ` pods-high ` , has changed and that
@@ -550,9 +485,9 @@ metadata:
550
485
spec:
551
486
hard:
552
487
requests.cpu: "1"
553
- requests.memory: 1Gi
488
+ requests.memory: " 1Gi"
554
489
limits.cpu: "2"
555
- limits.memory: 2Gi
490
+ limits.memory: " 2Gi"
556
491
requests.nvidia.com/gpu: 4
557
492
EOF
558
493
` ` `
0 commit comments