← All one-liners·#051·Operations·self contained·power

Find Pods Missing Resource Limits

Identifies all Kubernetes pods across all namespaces that have containers missing CPU or memory resource limits.

Setup
  • → kubectl configured with cluster access
  • → jq installed
Cost per run
Free
The one-liner
$ kubectl get pods -A -o json | jq -r '.items[] | select(any(.spec.containers[]; .resources.limits.cpu == null or .resources.limits.memory == null)) | "\(.metadata.namespace)/\(.metadata.name)"' | sort -u
What each stage does
  1. [01] kubectlkubectl get pods -A -o json
    Fetches all pods across all namespaces and outputs the raw data as a JSON object.
  2. [02] jqjq -r '.items[] | select(any(.spec.containers[]; .resources.limits.cpu == null o…
    Iterates through the pods and filters for those where any container lacks either CPU or memory limits.
  3. [03] jq"\(.metadata.namespace)/\(.metadata.name)"
    Formats the matched pods into a clean namespace/pod-name string.
  4. [04] sortsort -u
    Sorts the resulting list alphabetically and removes any duplicate entries.
Expected output (sample)
default/frontend-deployment-6b7984c77-x9q2z
default/redis-cache-0
kube-system/metrics-server-85c57975b4-p8j9k
monitoring/grafana-78459485b-4m2w9
Caveats & tips
  • Requires `get pods` RBAC permissions across all namespaces (`-A`), which might be restricted in multi-tenant clusters.
  • Does not check initContainers or ephemeralContainers, which can also consume resources without limits.