This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 16. Resource Limits
16.1. Overview Copia collegamentoCollegamento copiato negli appunti!
A LimitRange
object enumerates compute resource constraints in a project at the pod and container level. This allows you to specify the amount of resources that a pod or container can consume.
16.2. Setting Limit Range Constraints Copia collegamentoCollegamento copiato negli appunti!
All resource create and modification requests are evaluated against each LimitRange
object in the project. If the resource violates any of the enumerated constraints, then the resource is rejected. If the resource does not set an explicit value, and if the constraint supports a default value, then the default value is applied to the resource.
Example 16.1. Limit Range Object Definition
- 1
- The name of the limit range document.
- 2
- The maximum amount of CPU that a pod can request on a node across all containers.
- 3
- The maximum amount of memory that a pod can request on a node across all containers.
- 4
- The minimum amount of CPU that a pod can request on a node across all containers.
- 5
- The minimum amount of memory that a pod can request on a node across all containers.
- 6
- The maximum amount of CPU that a single container in a pod can request.
- 7
- The maximum amount of memory that a single container in a pod can request.
- 8
- The minimum amount of CPU that a single container in a pod can request.
- 9
- The minimum amount of memory that a single container in a pod can request.
- 10
- The default amount of CPU that a container will be limited to use if not specified.
- 11
- The default amount of memory that a container will be limited to use if not specified.
- 12
- The default amount of CPU that a container will request to use if not specified.
- 13
- The default amount of memory that a container will request to use if not specified.
- 14
- The maximum amount of CPU burst that a container can make as a ratio of its limit over request.
16.2.1. Container Limits Copia collegamentoCollegamento copiato negli appunti!
Supported Resources:
- CPU
- Memory
Supported Constraints:
Per container, the following must hold true if specified:
Constraint | Behavior |
---|---|
| Min[resource] ⇐ container.resources.requests[resource] (required) ⇐ container/resources.limits[resource] (optional)
If the configuration defines a |
| container.resources.limits[resource] (required) ⇐ Max[resource]
If the configuration defines a |
| MaxLimitRequestRatio[resource] ⇐ ( container.resources.limits[resource] / container.resources.requests[resource])
If a configuration defines a |
Supported Defaults:
- Default[resource] - defaults container.resources.limit[resource] to specified value if none
- Default Requests[resource] - defaults container.resources.requests[resource] to specified value if none
16.2.2. Pod Limits Copia collegamentoCollegamento copiato negli appunti!
Supported Resources:
- CPU
- Memory
Supported Constraints:
Across all containers in a pod, the following must hold true:
Constraint | Enforced Behavior |
---|---|
| Min[resource] less than or equal to container.resources.requests[resource] (required) less than or equal to container.resources.limits[resource] (optional) |
| container.resources.limits[resource] (required) less than or equal to Max[resource] |
| MaxLimitRequestRatio[resource] less than or equal to ( container.resources.limits[resource] / container.resources.requests[resource]) |
16.3. Creating a Limit Range Copia collegamentoCollegamento copiato negli appunti!
To apply a limit range to a project, create a limit range object definition on your file system to your desired specifications, then run:
oc create -f <limit_range_file>
$ oc create -f <limit_range_file>
16.4. Viewing Limits Copia collegamentoCollegamento copiato negli appunti!
To view limits enforced in a project:
16.5. Deleting Limits Copia collegamentoCollegamento copiato negli appunti!
Remove any active limit range to no longer enforce the limits of a project:
oc delete limits <limit_name>
$ oc delete limits <limit_name>