KubernetesCIX · LimitRangeLimitRange
PVC constraints — bounding storage requests
What you'll learn
- Configure PVC constraints (max, min)
- Reason about oversized PVC requests
- Apply the interaction with StorageClass quotas
- Apply the operational discipline of bounding PVCs
Prerequisites
Verified against Kubernetes 1.34.x · kubeadm 1.34.x · kubectl 1.34.x · etcd 3.6.x · CoreDNS 1.11.x · containerd 1.7.x / 2.x · 2026-08-16
PVC constraints in LimitRange bound the storage requests per PVC. This lesson walks the PVC limits, the use case, the interaction with quotas, and the discipline.
The PVC limits
apiVersion: v1
kind: LimitRange
metadata:
name: pvc-limits
namespace: tenant-a-prod
spec:
limits:
- type: PersistentVolumeClaim
max:
storage: 100Gi
min:
storage: 1Gi
The PVC fields:
- max. Maximum storage request. A PVC requesting 200Gi would be rejected.
- min. Minimum storage request. A PVC requesting 100Mi would be rejected.
The use case
flowchart LR
A["PVC request: 10Gi"] --> B{Within max?}
B -->|Yes| C[Accepted]
B -->|No| D["Rejected: above max"]
E["PVC request: 200Gi"] --> B
The use case: a tenant requests a 10TiB PVC for a Postgres database. The quota allows 1TiB total. The PVC max is 100Gi. The request is rejected at PVC admission.
Without PVC max, the request would be rejected at quota admission (later in the process), but the error is less specific. PVC max gives a clearer error message.
Interaction with storage quotas
flowchart LR
A[PVC creation request] --> B{Within PVC max?}
B -->|No| C["Rejected: PVC max"]
B -->|Yes| D{Within storage quota?}
D -->|No| E["Rejected: storage quota"]
D -->|Yes| F[Accepted]
The admission sequence:
- The PVC request is checked against PVC max.
- If within max, the storage quota is checked.
- If within quota, the PVC is accepted.
PVC max is an early check; storage quota is a later check. Both are needed for full enforcement.
PVC max in production
flowchart LR
A[Production PVC max] --> B["Database: 500Gi"]
A --> C["Application: 100Gi"]
A --> D["Cache: 50Gi"]
B --> E["Tier 1: high"]
C --> F["Tier 2: medium"]
D --> G["Tier 3: low"]
In practice, production deployments have different PVC max for different namespaces:
- Database namespace. PVC max 500Gi (Postgres databases can be large).
- Application namespace. PVC max 100Gi (most apps don’t need more).
- Cache namespace. PVC max 50Gi (caches are bounded).
The max is per-namespace; each namespace has its own LimitRange.
Quiz
Knowledge check · 4 questions
Q1. Why set a `max` on PVC storage requests in a LimitRange?
Q2. A namespace storage quota alone prevents one workload from consuming the entire storage budget.
Q3. One claim has taken the namespace's whole storage budget; bound the per-claim size without disturbing what is already bound.
`analytics-prod` has a ResourceQuota with `requests.storage: 1Ti` and `persistentvolumeclaims: 30`. A single PVC, `scratch-space`, was created at 1Ti and is Bound. A 20Gi PVC for a new service is now rejected with `exceeded quota: storage, requested: requests.storage=20Gi, used: requests.storage=1Ti, limited: requests.storage=1Ti`. `kubectl get limitrange -n analytics-prod` shows only a `Container` entry.
Q4. A 200Gi PVC is submitted to a namespace with both a PVC LimitRange `max.storage: 100Gi` and a `requests.storage: 1Ti` quota that has 800Gi free. Which check refuses it, and how would the outcome differ if only the quota existed?
Passing score: 75%. Answers are checked in this browser.
The operational discipline
PVC constraints in production rest on five non-negotiable elements:
- Set PVC max for every namespace. Prevent oversized PVCs.
- Set PVC min. Prevent zero-sized PVCs that may not bind.
- Tune per namespace. Database namespaces need higher max.
- Account for growth. PVCs can be expanded (StorageClass allows it); the max accommodates the expanded size.
- Test the constraints. Quarterly: create a PVC that exceeds max; verify rejection.
PVC constraints prevent oversized storage requests that can exhaust the backend. The discipline is to set the max based on workload characteristics and to monitor the storage quota.