agentleFS
scitixscitix/siclaw/skills/core/quota-debug/SKILL.md

quota-debug

Skill235 starsChanged 6 months agoApache-2.0View on GitHub

Diagnose Kubernetes native ResourceQuota and LimitRange admission rejections (exceeded quota, forbidden by LimitRange, FailedCreate). Checks namespace quotas, current usage, LimitRange constraints, and ReplicaSet events to identify why pods cannot be created. Not applicable to Volcano Queue — use volcano-queue-diagnose for gang scheduling clusters.

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. About 0 are common, 10 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When pods fail to be created due to Kubernetes native namespace-level resource constraints — ResourceQuota exceeded or LimitRange …

    line 11
  2. Very specific:

    Not applicable to Volcano Queue: If the cluster uses Volcano for gang scheduling, resource quotas are managed by Volcano Queue, not …

    line 17
  3. Very specific:

    If this command returns results (Queue resources listed), the cluster uses Volcano — use volcano-queue-diagnose.

    line 23
  4. Distinctive:

    If the user reports a Deployment not progressing or pods not appearing, first find the controller that owns the pods:

    line 29
  5. Very specific:

    Look for events with reason FailedCreate.

    line 41
  6. Distinctive:

    If the user already has a specific error message, skip to step 2.

    line 43
  7. Distinctive:

    Check current quota usage:

    line 53
  8. Distinctive:

    If no pods exist yet (all creation failed), check the Deployment or template spec:

    line 80
  9. Very specific:

    If Used is near Hard for cpu/memory: existing pods are consuming most of the quota — need to scale down other workloads or increase quota

    line 87
  10. Very specific:

    If pods count is at the limit: too many pods in namespace — clean up or increase quota

    line 88
  11. Distinctive:

    If the pod's resource requests are very large: consider reducing requests to fit within remaining quota

    line 89
  12. Very specific:

    Check the Min column for Container type.

    line 105
  13. Very specific:

    Check LimitRange as above and compare the Max column with the container's resource requests/limits.

    line 115
  14. Very specific:

    Check the Max Limit/Request Ratio column.

    line 127
  15. Very specific:

    Check if the LimitRange has Default and DefaultRequest values:

    line 139
  16. Very specific:

    If Default and DefaultRequest are empty but Min or Max are set, containers MUST explicitly specify resources.

    line 145
  17. Distinctive:

    If the sum of all container resources exceeds the Pod-level max, admission is rejected.

    line 157
  18. Very specific:

    If the error mentions requests.storage or persistentvolumeclaims:

    line 163
  19. Distinctive:

    Check the storage-related rows.

    line 169
  20. Very specific:

    Look for keys like <storageclass>.storageclass.storage.k8s.io/requests.storage.

    line 175
  21. Distinctive:

    All ResourceQuotas must be satisfied (intersection).

    line 185
  22. Very specific:

    Look for spec.scopes or spec.scopeSelector.

    line 195
  23. Distinctive:

    When a namespace has a ResourceQuota for compute resources (cpu/memory), every container must specify requests/limits for those resources, …

    line 200

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

ResourceQuota & LimitRange Admission Diagnosis

When pods fail to be created due to Kubernetes native namespace-level resource constraints — ResourceQuota exceeded or LimitRange violations — follow this flow to identify the root cause.

Scope: This skill is for diagnosis only. Once you identify the root cause, report it to the user and stop. Do NOT attempt to modify ResourceQuota, LimitRange, or pod specs — that should be left to the user or cluster administrator.

When to use: Pods are not being created at all (not Pending, not CrashLoopBackOff — simply missing). Typical trigger: a ReplicaSet or Job shows FailedCreate events mentioning exceeded quota or forbidden: ... LimitRange.

Not applicable to Volcano Queue: If the cluster uses Volcano for gang scheduling, resource quotas are managed by Volcano Queue, not Kubernetes native ResourceQuota. Use the volcano-queue-diagnose skill instead. To check:

kubectl get queue 2>/dev/null

If this command returns results (Queue resources listed), the cluster uses Volcano — use volcano-queue-diagnose. If it returns nothing or an error, Volcano is not installed — continue with this skill.

Diagnostic Flow

1. Identify the creation failure

If the user reports a Deployment not progressing or pods not appearing, first find the controller that owns the pods:

kubectl get rs -n <ns> --sort-by='.metadata.creationTimestamp' | grep <deployment-name>

Then check the ReplicaSet events for creation failures:

kubectl describe rs <new-rs> -n <ns>

Look for events with reason FailedCreate. The event message reveals whether it is a ResourceQuota or LimitRange rejection.

If the user already has a specific error message, skip to step 2.

2. Match the rejection type


exceeded quota — ResourceQuota exhausted

The namespace has a ResourceQuota and creating the pod would exceed the allowed limits.

Check current quota usage:

kubectl get resourcequota -n <ns>

For detailed usage breakdown:

kubectl describe resourcequota -n <ns>

Compare the Used vs Hard columns. Common quota dimensions:

  • requests.cpu / requests.memory — total CPU/memory requests across all pods in the namespace
  • limits.cpu / limits.memory — total CPU/memory limits
  • pods — maximum number of pods allowed in the namespace
  • count/deployments.apps, count/services — object count limits
  • requests.nvidia.com/gpu — total GPU requests (common in GPU-scheduled clusters)
  • requests.storage — total PVC storage requested
  • persistentvolumeclaims — number of PVCs

Then check what the pod is requesting:

kubectl get pod -n <ns> -l app=<name> -o jsonpath='{range .items[0].spec.containers[*]}{.name}{"\t"}{.resources}{"\n"}{end}' 2>/dev/null

If no pods exist yet (all creation failed), check the Deployment or template spec:

kubectl get deployment <name> -n <ns> -o jsonpath='{range .spec.template.spec.containers[*]}{.name}{"\t"}{.resources}{"\n"}{end}'

Root cause analysis:

  • If Used is near Hard for cpu/memory: existing pods are consuming most of the quota — need to scale down other workloads or increase quota
  • If pods count is at the limit: too many pods in namespace — clean up or increase quota
  • If the pod's resource requests are very large: consider reducing requests to fit within remaining quota

forbidden: ... minimum cpu/memory — LimitRange minimum violation

The pod's container does not meet the minimum resource request required by the namespace's LimitRange.

kubectl get limitrange -n <ns>
kubectl describe limitrange -n <ns>

Check the Min column for Container type. If a container does not specify resource requests, or its requests are below the minimum, admission will be rejected.

Compare with the pod's resource spec. If the container has no resource requests at all, the LimitRange default will be applied — but if the LimitRange has min without default, admission fails.


forbidden: ... maximum cpu/memory — LimitRange maximum violation

The pod's container exceeds the maximum resource limit allowed by the LimitRange.

Check LimitRange as above and compare the Max column with the container's resource requests/limits.


forbidden: ... maxLimitRequestRatio — LimitRange ratio violation

The ratio between the container's resource limit and request exceeds the allowed ratio (e.g., limit is 10x the request, but ratio cap is 3x).

kubectl describe limitrange -n <ns>

Check the Max Limit/Request Ratio column. Then compare the pod's limits vs requests:

kubectl get deployment <name> -n <ns> -o jsonpath='{range .spec.template.spec.containers[*]}{.name}{"\t requests:"}{.resources.requests}{"\t limits:"}{.resources.limits}{"\n"}{end}'

forbidden: ... no resources specified — Missing required resources

The LimitRange requires resource specifications, but the container has none and no defaults are configured.

Check if the LimitRange has Default and DefaultRequest values:

kubectl describe limitrange -n <ns>

If Default and DefaultRequest are empty but Min or Max are set, containers MUST explicitly specify resources.


Pod type LimitRange — min/max per pod

LimitRange can also enforce constraints at the Pod level (sum of all containers). Check if the LimitRange has a Pod type entry:

kubectl get limitrange -n <ns> -o jsonpath='{range .items[*].spec.limits[*]}{.type}{"\t min:"}{.min}{"\t max:"}{.max}{"\n"}{end}'

If the sum of all container resources exceeds the Pod-level max, admission is rejected.


exceeded quota for storage — PVC quota exhausted

If the error mentions requests.storage or persistentvolumeclaims:

kubectl describe resourcequota -n <ns>

Check the storage-related rows. Also check if there are per-StorageClass quotas:

kubectl get resourcequota -n <ns> -o yaml

Look for keys like <storageclass>.storageclass.storage.k8s.io/requests.storage.

3. Check for multiple constraints

A namespace can have multiple ResourceQuotas and LimitRanges. Always check for all of them:

kubectl get resourcequota,limitrange -n <ns>

All ResourceQuotas must be satisfied (intersection). The most restrictive LimitRange applies.

4. Verify scoped quotas

ResourceQuotas can be scoped to specific priority classes or pod phases:

kubectl get resourcequota -n <ns> -o yaml

Look for spec.scopes or spec.scopeSelector. A scoped quota only applies to pods matching the scope (e.g., PriorityClass=high). If the user's pod has a specific priority class, it may hit a scoped quota while the general quota still has capacity.

Notes

  • ResourceQuota admission happens before scheduling. A pod rejected by quota will never appear in kubectl get pods — look at the controller (ReplicaSet, Job) events instead.
  • When a namespace has a ResourceQuota for compute resources (cpu/memory), every container must specify requests/limits for those resources, otherwise admission is rejected. This catches users who are used to running without resource specs.
  • LimitRange can automatically inject default requests/limits into containers that don't specify them. Check if defaults are configured before telling users to add explicit resource specs.
  • For cross-reference: if the pod IS created but stuck in Pending, use the pod-pending-debug skill instead — that covers scheduling failures (node resources, taints, affinity).
  • kubectl top pods -n <ns> shows actual resource usage, while quota tracks requested resources. A namespace can hit quota limits even if actual usage is low. Note: kubectl top requires metrics-server to be installed — if it returns an error, skip it and rely on quota Used values instead.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.