kubectl get pods: "No resources found" - Causes and Fixes
$ kubectl get pods
No resources found in default namespace.
This is not an error - kubectl asked the API server a question and the honest answer was "nothing matches". The pods you expect exist somewhere else, under a different name, or were never created. Work through the causes below in order; the first two explain most cases.
1. Wrong Namespace (Most Common)
Without -n, kubectl looks only in the namespace of your current context - usually default. Applications normally live in their own namespace.
# Look everywhere
kubectl get pods -A # same as --all-namespaces
# Which namespaces exist?
kubectl get namespaces
# Query the right one
kubectl get pods -n my-app
# Make it the default for this context
kubectl config set-context --current --namespace=my-app
Note the capital letter: -A means all namespaces. Lowercase -a was the old --show-all flag, which has been removed - it will not show hidden pods.
2. Wrong Cluster or Context
If you work with several clusters (staging, production, a local kind/minikube), you may be asking the wrong one.
kubectl config current-context
kubectl config get-contexts
kubectl config use-context production
# Which API server am I talking to?
kubectl cluster-info
Also check KUBECONFIG: an environment variable pointing at another file silently changes the context in that shell.
3. A Selector That Matches Nothing
Label (-l) and field (--field-selector) filters return "No resources found" when nothing matches - including on a typo.
# What labels do the pods actually have?
kubectl get pods -n my-app --show-labels
# Then filter with a label that exists
kubectl get pods -n my-app -l app.kubernetes.io/name=web
# Field selectors: Running only / not Running
kubectl get pods -A --field-selector status.phase=Running
kubectl get pods -A --field-selector status.phase!=Running
4. The Pods Were Never Created
A Deployment can exist while its pods do not: the ReplicaSet tried to create them and was rejected. kubectl get pods shows nothing, and the reason is in the events one level up.
kubectl get deploy,rs -n my-app
kubectl describe rs -n my-app <replicaset-name> # read the Events section
kubectl get events -n my-app --sort-by=.lastTimestamp | tail -n 20
Typical reasons in the events:
| Event message | Cause | Fix |
|---|---|---|
exceeded quota |
A ResourceQuota is full |
Raise the quota or lower requests |
forbidden: ... violates PodSecurity |
Pod Security Admission blocks the spec | Adjust securityContext or the namespace label |
admission webhook ... denied the request |
A policy engine (Kyverno, Gatekeeper) rejected it | Read the policy message |
serviceaccount ... not found |
The referenced ServiceAccount is missing | Create it or fix the name |
Deployment shows 0/0 |
Scaled to zero (by a person, HPA/KEDA or a GitOps sync) | kubectl scale deploy/<name> --replicas=1 |
5. The Pods Existed but Are Gone
- Jobs and CronJobs delete finished pods when
ttlSecondsAfterFinishedor the history limits (successfulJobsHistoryLimit,failedJobsHistoryLimit) kick in. Check withkubectl get jobs,cronjobs -n <ns>. - Evicted or deleted pods are replaced under new names; the old ones disappear.
kubectl get eventsstill shows them for about an hour by default. - Static and DaemonSet pods exist only on matching nodes - check
kubectl get nodesand node selectors.
Not "No resources found" but "Forbidden"?
If RBAC denies you, kubectl says so explicitly (pods is forbidden: User ... cannot list resource "pods"). Check what you are allowed to do:
kubectl auth can-i list pods -n my-app
kubectl auth whoami # kubectl 1.28+
Pod Restart History
Once you find the pods, the next question is usually "has it been restarting?". Kubernetes keeps only a counter and the last terminated state - there is no full restart log.
# RESTARTS column; sort by restart count
kubectl get pods -n my-app --sort-by='.status.containerStatuses[0].restartCount'
# Why did it restart last time? (Last State: Terminated, Reason: OOMKilled / Error, Exit Code)
kubectl describe pod -n my-app <pod>
# Logs from the previous (crashed) container instance
kubectl logs -n my-app <pod> --previous
# Recent events for this pod only
kubectl get events -n my-app --field-selector involvedObject.name=<pod>
For a longer history you need to record it yourself - with a metrics stack (kube_pod_container_status_restarts_total from kube-state-metrics) or by storing periodic kubectl get pods output. For more on reading pod state and resources, see monitoring Kubernetes pod status and resources.
Record Pod State Over Time With Zuzia
If you run a small cluster, a scheduled task on a machine that has kubectl access (with the Zuzia agent installed) can run:
kubectl get pods -A --field-selector status.phase!=Running,status.phase!=Succeeded
every few minutes. Zuzia keeps the output of every run with an AI summary, which gives you the restart and failure history Kubernetes itself does not keep.
FAQ
Why does kubectl get pods say "No resources found in default namespace"?
Because your pods are in another namespace. Run kubectl get pods -A to see pods in every namespace, then use -n <namespace>.
How do I list pods in all namespaces?
kubectl get pods -A (or --all-namespaces). Add -o wide to see the node and pod IP.
What does kubectl get pods -a do?
Nothing useful on current versions: -a/--show-all was deprecated and removed. You probably meant -A (all namespaces).
How do I see why a pod keeps restarting?
kubectl describe pod <pod> shows the last termination reason and exit code, and kubectl logs <pod> --previous shows the logs of the crashed instance. OOMKilled means the memory limit is too low.
How do I check pod status in Kubernetes?
kubectl get pods -n <ns> shows the STATUS and RESTARTS columns; kubectl get pod <pod> -o jsonpath='{.status.phase}' returns just the phase for scripts.