Skip to content

Latest commit

 

History

History
134 lines (101 loc) · 5.6 KB

File metadata and controls

134 lines (101 loc) · 5.6 KB

Limit ranges in a LimitRange object

To define compute resource constraints at the object level, create a LimitRange object. By creating this object, you can specify the exact amount of resources that an individual 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.

Core limit range object definition
apiVersion: "v1"
kind: "LimitRange"
metadata:
  name: "core-resource-limits"
spec:
  limits:
    - type: "Pod"
      max:
        cpu: "2"
        memory: "1Gi"
      min:
        cpu: "200m"
        memory: "6Mi"
    - type: "Container"
      max:
        cpu: "2"
        memory: "1Gi"
      min:
        cpu: "100m"
        memory: "4Mi"
      default:
        cpu: "300m"
        memory: "200Mi"
      defaultRequest:
        cpu: "200m"
        memory: "100Mi"
      maxLimitRequestRatio:
        cpu: "10"
# ...

where:

metadata.name

Specifies the name of the limit range object.

max.cpu

Specifies the maximum amount of CPU that a pod can request on a node across all containers.

max.memory

Specifies the maximum amount of memory that a pod can request on a node across all containers.

min.cpu

Specifies 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 set min to 0, the result is no limit and the pod can consume more than the max CPU value.

min.memory

Specifies 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 set min to 0, the result is no limit and the pod can consume more than the max memory value.

max.cpu

Specifies the maximum amount of CPU that a single container in a pod can request.

max.memory

Specifies the maximum amount of memory that a single container in a pod can request.

min.cpu

Specifies the minimum amount of CPU that a single container in a pod can request. If you do not set a min value or you set min to 0, the result is no limit and the pod can consume more than the max CPU value.

max.memory

Specifies the minimum amount of memory that a single container in a pod can request. If you do not set a min value or you set min to 0, the result is no limit and the pod can consume more than the max memory value.

default.cpu

Specifies the default CPU limit for a container if you do not specify a limit in the pod specification.

default.memory

Specifies the default memory limit for a container if you do not specify a limit in the pod specification.

defaultRequest.cpu

Specifies the default CPU request for a container if you do not specify a request in the pod specification.

defaultRequest.memory

Specifies the default memory request for a container if you do not specify a request in the pod specification.

maxLimitRequestRatio.cpu

Specifies the maximum limit-to-request ratio for a container.

{product-title} Limit range object definition
apiVersion: "v1"
kind: "LimitRange"
metadata:
  name: "openshift-resource-limits"
spec:
  limits:
    - type: openshift.io/Image
      max:
        storage: 1Gi
    - type: openshift.io/ImageStream
      max:
        openshift.io/image-tags: 20
        openshift.io/images: 30
    - type: "Pod"
      max:
        cpu: "2"
        memory: "1Gi"
        ephemeral-storage: "1Gi"
      min:
        cpu: "1"
        memory: "1Gi"
# ...

where:

limits.max.storage

Specifies the maximum size of an image that can be pushed to an internal registry.

limits.max.openshift.io/image-tags

Specifies the maximum number of unique image tags as defined in the specification for the image stream.

limits.max.openshift.io/images

Specifies the maximum number of unique image references as defined in the specification for the image stream status.

type.max.cpu

Specifies the maximum amount of CPU that a pod can request on a node across all containers.

type.max.memory

Specifies the maximum amount of memory that a pod can request on a node across all containers.

type.max.ephemeral-storage

Specifies the maximum amount of ephemeral storage that a pod can request on a node across all containers.

min.cpu

Speciifes the minimum amount of CPU that a pod can request on a node across all containers. See the Supported Constraints table for important information.

min.memory

Specifies 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 set min to 0, the result is no limit and the pod can consume more than the max memory value.

You can specify both core and {product-title} resources in one limit range object.