Part 03: How to force quotas limit to Kubernetes Storage

Balkrishna Pandey
Goglides
Published in
3 min readJun 18, 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 Storage

Limiting Storage resources

Using LimitRange it is possible to enforce minimum and maximum size of storage resources that can be requested by each PersistentVolumeClaim in a namespace.

Create a file limitrange-storage.yaml

apiVersion: v1
kind: Namespace
metadata:
name: limitrange-storage-demo3
---
apiVersion: v1
kind: LimitRange
metadata:
name: storagelimits
namespace: limitrange-storage-demo3
spec:
limits:
- type: PersistentVolumeClaim
max:
storage: 2Gi
min:
storage: 1Gi

Apply the YAML file using:

kubectl apply -f limitrange-storage.yaml

Describe the created object:

kubectl describe -f limitrange-storage.yaml
Output:
Name: limitrange-storage-demo3
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Namespace","metadata":{"annotations":{},"name":"limitrange-storage-demo3"}}
Status: Active
No resource quota.Resource Limits
Type Resource…

--

--