Part 04: How to force quotas limit to Kubernetes resources (limits/request ratio)

Balkrishna Pandey
Goglides
Published in
2 min readJun 20, 2020

--

This blog is a continuation of previous blog series https://goglides.io/2020/03/03/limit-range-kubernetes/

How to force quotas limit to Kubernetes resources (limits/request ratio)

Limits/Requests Ratio

If LimitRangeItem.maxLimitRequestRatio is specified in the LimitRangeSpec,

  • the named resource must have a request and limit
  • both request and limit should be non-zero (>0)
  • limit divided by request is less than or equal to the enumerated value

Following manifest (limitrange-limit-request-ratio.yaml) saying limit to be at most twice the amount of memory request,

apiVersion: v1
kind: Namespace
metadata:
name: limitrange-demo3
---
apiVersion: v1
kind: LimitRange
metadata:
name: limit-memory-ratio-pod
namespace: limitrange-demo3
spec:
limits:
- maxLimitRequestRatio:
memory: 2
type: Pod

apply YAML,

kubectl apply -f limitrange-limit-request-ratio.yamlOutput:
namespace/limitrange-demo3 created
limitrange/limit-memory-ratio-pod created

Describe the limitrange,

kubectl describe -f limitrange-limit-request-ratio.yamlOutput:
Name: limitrange-demo3…

--

--