← Back to Blog
TutorialDecember 19, 2024·7 min read

5 kubectl Commands That Reveal Hidden Kubernetes Waste

No fancy tools required. These built-in commands show you exactly where your cluster is bleeding money.

Before you install any monitoring tool or sign up for any SaaS platform, you can find significant waste in your Kubernetes cluster using commands you already have. Here are the 5 kubectl commands I run on every cluster I audit.

1Find Over-Provisioned Pods

This command shows actual CPU/memory usage vs what's requested. The gap is your waste.

terminal
kubectl top pods --all-namespaces --sort-by=memory

Example output:

NAMESPACE     NAME                          CPU(cores)   MEMORY(bytes)
prod          api-gateway-7d4f8b6c9-x2k4j   45m          412Mi
prod          worker-pool-5c6d7e8f9-a1b2c   82m          1.2Gi
staging       redis-cache-3e4f5a6b7-c8d9e   12m          89Mi

Now compare to what's requested:

kubectl get pods --all-namespaces -o custom-columns=\
"NAMESPACE:.metadata.namespace,\
NAME:.metadata.name,\
CPU_REQ:.spec.containers[*].resources.requests.cpu,\
MEM_REQ:.spec.containers[*].resources.requests.memory"

What to look for: Pods using 10-20% of requested resources. A pod requesting 4Gi but using 400Mi is wasting ~$25/month.

2Find Orphaned LoadBalancers

LoadBalancer services cost $15-20/month each on most cloud providers. Many clusters have orphaned ones from deleted deployments.

kubectl get svc --all-namespaces -o wide | grep LoadBalancer

Then check if pods are actually behind each one:

# For each LoadBalancer service, check endpoints
kubectl get endpoints <service-name> -n <namespace>
# Empty endpoints = orphaned LoadBalancer = $18/month wasted
NAME              ENDPOINTS
old-api-service   <none>

Found one with no endpoints? Delete it: kubectl delete svc old-api-service -n namespace

3Find Unbound PersistentVolumeClaims

PVCs that aren't bound to pods still cost money. Storage isn't free.

kubectl get pvc --all-namespaces | grep -v Bound
NAMESPACE   NAME                    STATUS    VOLUME   CAPACITY
staging     old-postgres-data       Pending   -        100Gi
dev         test-volume-claim       Pending   -        50Gi

Also check for PVs (the actual storage) that lost their claim:

kubectl get pv | grep Released

Cost impact: A 100Gi SSD volume costs ~$10/month on most providers. Multiply by forgotten dev environments and it adds up.

4Find Pods Without Resource Requests

Pods without requests are the scheduler's nightmare. They can't be bin-packed efficiently, leading to wasted node capacity.

kubectl get pods --all-namespaces -o json | jq -r '
  .items[] | 
  select(.spec.containers[].resources.requests == null) | 
  "\(.metadata.namespace)/\(.metadata.name)"'

No jq? Use this instead:

kubectl get pods --all-namespaces -o custom-columns=\
"NAMESPACE:.metadata.namespace,\
NAME:.metadata.name,\
REQUESTS:.spec.containers[*].resources.requests" | grep "<none>"

Fix: Add resource requests to all pods. Even a rough estimate is better than nothing. Start with 256Mi memory and 100m CPU, then adjust based on actual usage.

5Find Node Capacity Waste

See how much of your nodes' capacity is actually being used vs allocated.

kubectl top nodes
NAME                          CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
node-pool-1-abc123            1204m        30%    8.2Gi           51%
node-pool-1-def456            892m         22%    6.1Gi           38%
node-pool-1-ghi789            2103m        52%    12.4Gi          77%

Compare to what's allocated (requests):

kubectl describe nodes | grep -A 5 "Allocated resources"

The gap: If allocated is 80% but actual usage is 30%, your pods are over-requesting by ~2.5x. Right-size requests to recover that capacity.

Put It All Together

Here's a one-liner that gives you a quick waste summary:

curl -sL wozz.io/audit.sh | bash

This runs all these checks (and more) and calculates the actual dollar impact. Takes 30 seconds, runs locally, no signup required.

Quick Reference

IssueCommandTypical Savings
Over-provisioned podskubectl top pods$20-100/pod/month
Orphaned LoadBalancerskubectl get svc$18/each/month
Unbound PVCskubectl get pvc$0.10/GB/month
No resource requestskubectl get pods -o jsonVaries (scheduling waste)
Node underutilizationkubectl top nodes$50-500/node/month

Want the Full Picture?

These commands are great for spot-checking, but Wozz automates all of this and calculates the exact dollar impact across your entire cluster.