Q: What is the difference between `kubectl get` and `kubectl describe`?
get = brief summary table. describe = full detail including events. Use describe for debugging.
Want to master this scenario in a live sandbox? KodeKloud's CKA & CKAD Hands-On Certification Track covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: <strong>kubectl get vs describe:</strong> <code>get</code> returns the stored object (a table or the raw YAML/JSON) and is the right tool for lists, scripting and automation, while <code>describe</code> renders a human-readable summary that also pulls in related Events, which makes it the first stop when something is failing. Interviewers ask this to see whether you know that <code>describe</code> output is a presentation layer you should never parse, and that Events (not the spec) usually explain why a pod is Pending or crash-looping. A strong answer names both sides and says when each one fits.
Mental model: stored object vs rendered summary
One command reads the API object, the other assembles a report from several API calls.
- kubectl get: fetches the resource (or a list) and prints a server-side table by default;
-o yamlor-o jsongives the full object includingstatus,ownerReferencesandmetadata.managedFields(hidden unless--show-managed-fields). - kubectl describe: formats the object client-side in kubectl and adds related data such as the Events that reference it, for a Pod also its node, QoS class, probes, mounts and container states.
- Stability:
get -o jsonfollows the API schema and is safe to script.describetext layout is not an API and can change between kubectl versions. - Scope:
getworks across many objects at once (-A,-l,--watch);describeis meant for one object or a small selected set.
kubectl get: lists, filtering and scripting
Use get when you need breadth, exact field values or machine-readable output.
# Table of pods with node and IP
kubectl get pods -n prod -l app=my-app -o wide
# One field, script-friendly
kubectl get pod my-app-7d9c-xk2lp -n prod -o jsonpath='{.status.phase}{"\n"}'
# Custom table: pod name and restart count
kubectl get pods -n prod -o custom-columns=NAME:.metadata.name,RESTARTS:.status.containerStatuses[0].restartCount
# Who owns this pod? (ReplicaSet -> Deployment chain)
kubectl get pod my-app-7d9c-xk2lp -n prod -o jsonpath='{.metadata.ownerReferences[0].kind}/{.metadata.ownerReferences[0].name}{"\n"}'
- Wide view:
-o wideadds node and IP columns without leaving table form. - Extract a field:
-o jsonpathor-o custom-columnsreturns exactly the fields you need for a script or a quick audit. - Watch rollouts:
-wstreams changes, handy while a Deployment rolls out. - Full truth:
-o yamlshowsstatus.conditionsandownerReferences, which describe only partially renders.
kubectl describe: Events first, then conditions
Reach for describe when you need to know why something is not happening.
kubectl describe pod my-app-7d9c-xk2lp -n prod
# Look at: State/Last State, Conditions, Events (bottom)
# Same events, filtered and sorted (kubectl 1.26+)
kubectl events -n prod --for pod/my-app-7d9c-xk2lp
# Older equivalent
kubectl get events -n prod --field-selector involvedObject.name=my-app-7d9c-xk2lp --sort-by=.lastTimestamp
- Events section: at the bottom, shows scheduler and kubelet messages such as
FailedScheduling,FailedMount,BackOffor image pull errors. - Container state: shows
Last State, exit code, reason (OOMKilled,Error) and restart count in one place. - Node view:
describe nodeshows allocatable vs requested resources, taints and conditions, the quickest way to see why a pod will not fit. - Cross-check events: events are namespaced and short-lived (retained for about an hour by default), so capture them early.
Combining both in a real triage
Use get to find the object and confirm facts, describe to explain them.
kubectl get pods -A --field-selector status.phase!=Running
kubectl describe pod my-app-7d9c-xk2lp -n prod | sed -n '/Events:/,$p'
kubectl get pod my-app-7d9c-xk2lp -n prod -o yaml | grep -A8 resources:
kubectl logs my-app-7d9c-xk2lp -n prod --previous
- Step 1:
get pods -Awith a field selector isolates the unhealthy pods quickly. - Step 2:
describeon one representative pod gives the reason from Events. - Step 3:
get -o yamlconfirms the effective spec (resources, probes, nodeSelector) the controller actually produced. - Step 4:
logs --previousadds application-level evidence for crash loops.
Pitfalls and what to automate
Know where each command misleads you.
- Do not parse describe: use
-o jsonwithjqor jsonpath in CI and runbooks. - Events expire: ship them to your logging stack so evidence survives the retention window.
- Secrets:
describe secrethides values butget secret -o yamlshows base64 data, so restrict RBAC onget. - Stale view: a table from
getcan lag a fast-changing object, so add-wor re-run.
- kubectl get returns the stored API object as a table, YAML or JSON and is what you script against.
- kubectl describe renders a human-readable summary and adds related Events, so I use it first when a pod is Pending or crash-looping.
- I never parse describe output; automation uses -o json or jsonpath, and I export Events because they expire.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Parsing kubectl describe output with grep/awk in scripts Its text layout is not part of the API and changes between kubectl versions, which silently breaks automation.
- Running only get when a pod is Pending The table shows the phase but not the scheduler reason; that lives in Events visible through describe.
- Waiting too long to read Events Events are retained only briefly by default, so the failure message may be gone by the time you investigate.
- Assuming describe shows the full spec It is a summary; fields like managedFields, full ownerReferences and some annotations only appear in get -o yaml.