Skip to content

CICD-284 · Kubernetes resource quota validation ​

Encyclopedia · Advanced Kubernetes operations · All snippets

Previous · CICD-283 · Next · CICD-285

1. Where it fits ​

  • Placement CI quota check.
  • Prerequisites kubectl, isolated cluster or namespace and installed CRDs when named.
  • Platforms kubernetes, local-lab.

2. Copy the snippet ​

bash
kubectl -n staging get resourcequota -o json | jq -e '.items | length > 0'
kubectl -n staging apply --dry-run=server -f manifests/workload.yaml

3. How it works ​

The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate. Server-side dry run sends the candidate through API validation and admission without persisting the change.

4. Verify the result ​

Dry-run rendered Pods as well when quota is enforced at Pod admission. Expect resource requests to fit remaining quota.

Validation syntax-validated (Bash parse). Status definitions.