Este contenido no está disponible en el idioma seleccionado.
Chapter 25. Setting Limit Ranges
25.1. Purpose for Limit Ranges Copiar enlaceEnlace copiado en el portapapeles!
A limit range, defined by a LimitRange
object, enumerates compute resource constraints in a project at the pod, container, image, image stream, and persistent volume claim level, and specifies the amount of resources that a pod, container, image, image stream, or persistent volume claim can consume.
All requests to create and modify resources are evaluated against each LimitRange
object in the project. If the resource violates any of the enumerated constraints, the resource is rejected. If the resource does not set an explicit value, and if the constraint supports a default value, the default value is applied to the resource.
For CPU and memory limits, if you specify a maximum value but do not specify a minimum limit, the resource can consume more CPU and memory resources than the maximum value.
You can specify limits and requests for ephemeral storage by using the ephemeral storage technology preview. This feature is disabled by default. To enable this feature, see configuring for ephemeral storage.
Core Limit Range Object Definition
- 1
- The name of the limit range object.
- 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. If you do not set a
min
value or you setmin
to0
, the result is no limit and the pod can consume more than themax
CPU value. - 5
- The minimum amount of memory that a pod can request on a node across all containers. If you do not set a
min
value or you setmin
to0
, the result is no limit and the pod can consume more than themax
memory value. - 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. If you do not set a
min
value or you setmin
to0
, the result is no limit and the pod can consume more than themax
CPU value. - 9
- The minimum amount of memory that a single container in a pod can request. If you do not set a
min
value or you setmin
to0
, the result is no limit and the pod can consume more than themax
memory value. - 10
- The default CPU limit for a container if you do not specify a limit in the pod specification.
- 11
- The default memory limit for a container if you do not specify a limit in the pod specification.
- 12
- The default CPU request for a container if you do not specify a request in the pod specification.
- 13
- The default memory request for a container if you do not specify a request in the pod specification.
- 14
- The maximum limit-to-request ratio for a container.
For more information on how CPU and memory are measured, see Compute Resources.
OpenShift Container Platform Limit Range Object Definition
- 1
- The maximum size of an image that can be pushed to an internal registry.
- 2
- The maximum number of unique image tags as defined in the specification for the image stream.
- 3
- The maximum number of unique image references as defined in the specification for the image stream status.
- 4
- The maximum amount of CPU that a pod can request on a node across all containers.
- 5
- The maximum amount of memory that a pod can request on a node across all containers.
- 6
- The maximum amount of ephemeral storage that a pod can request on a node across all containers, if the ephemeral storage technology preview is enabled.
- 7
- The minimum amount of CPU that a pod can request on a node across all containers. If you do set a
min
value or you setmin
to0
, the result is no limit and the pod can consume more than themax
CPU value. - 8
- The minimum amount of memory that a pod can request on a node across all containers. If you do not set a
min
value or you setmin
to0
, the result` is no limit and the pod can consume more than themax
memory value.
You can specify both core and OpenShift Container Platform resources in one limit range object. They are shown separately in two examples for clarity.
25.1.1. Container Limits Copiar enlaceEnlace copiado en el portapapeles!
Supported Resources:
- CPU
- Memory
Supported Constraints:
Per container, the following must hold true if specified:
Constraint | Behavior |
---|---|
|
If the configuration defines a |
|
If the configuration defines a |
|
If the limit range defines a
For example, if a container has |
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.
25.1.2. Pod Limits Copiar enlaceEnlace copiado en el portapapeles!
Supported Resources:
- CPU
- Memory
Supported Constraints:
Across all containers in a pod, the following must hold true:
Constraint | Enforced Behavior |
---|---|
|
|
|
|
|
|
25.1.3. Image Limits Copiar enlaceEnlace copiado en el portapapeles!
Supported Resources:
- Storage
Resource type name:
-
openshift.io/Image
Per image, the following must hold true if specified:
Constraint | Behavior |
---|---|
|
|
To prevent blobs that exceed the limit from being uploaded to the registry, the registry must be configured to enforce quota. The REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ENFORCEQUOTA
environment variable must be set to true
. By default, the environment variable is set to true
for new deployments.
The image size is not always available in the manifest of an uploaded image. This is especially the case for images built with Docker 1.10 or higher and pushed to a v2 registry. If such an image is pulled with an older Docker daemon, the image manifest is converted by the registry to schema v1 and does not include all the size information. No storage limit set on images will prevent it from being uploaded.
The issue is being addressed.
25.1.4. Image Stream Limits Copiar enlaceEnlace copiado en el portapapeles!
Supported Resources:
-
openshift.io/image-tags
-
openshift.io/images
Resource type name:
-
openshift.io/ImageStream
Per image stream, the following must hold true if specified:
Constraint | Behavior |
---|---|
|
|
|
|
25.1.4.1. Counting of Image References Copiar enlaceEnlace copiado en el portapapeles!
The openshift.io/image-tags
resource represents unique image references. Possible references are an ImageStreamTag
, an ImageStreamImage
, or a DockerImage
. Tags can be created by using the oc tag
and oc import-image
commands or by using tag tracking. No distinction is made between internal and external references. However, each unique reference that is tagged in an image stream specification is counted just once. It does not restrict pushes to an internal container image registry in any way, but is useful for tag restriction.
The openshift.io/images
resource represents unique image names that are recorded in image stream status. It allows for restriction of a number of images that can be pushed to the internal registry. Internal and external references are not distinguished.
25.1.5. PersistentVolumeClaim Limits Copiar enlaceEnlace copiado en el portapapeles!
Supported Resources:
- Storage
Supported Constraints:
Across all persistent volume claims in a project, the following must hold true:
Constraint | Enforced Behavior |
---|---|
| Min[resource] <= claim.spec.resources.requests[resource] (required) |
| claim.spec.resources.requests[resource] (required) <= Max[resource] |
Limit Range Object Definition
25.2. Creating a Limit Range Copiar enlaceEnlace copiado en el portapapeles!
To apply a limit range to a project:
- Create a limit range object definition with your required specifications.
Create the object:
oc create -f <limit_range_file> -n <project>
$ oc create -f <limit_range_file> -n <project>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
25.3. Viewing a Limit Copiar enlaceEnlace copiado en el portapapeles!
You can view any limit ranges that are defined in a project by navigating in the web console to the Quota page for the project.
You can also use the CLI to view limit range details by performing the following steps:
Get the list of limit range objects that are defined in the project. For example, for a project called demoproject:
oc get limits -n demoproject
$ oc get limits -n demoproject
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Output
NAME AGE resource-limits 6d
NAME AGE resource-limits 6d
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Describe the limit range. For example, for a limit range called resource-limits:
oc describe limits resource-limits -n demoproject
$ oc describe limits resource-limits -n demoproject
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example Output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
25.4. Deleting a Limit Range Copiar enlaceEnlace copiado en el portapapeles!
To remove a limit range and no longer enforce the limits of a project:
Run the following command:
oc delete limits <limit_name>
$ oc delete limits <limit_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow