⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Kubernetes Interview Questions Scenario 98 of 207 in Kubernetes
Junior / Associate DevOps [L1] Kubernetes Advanced Scenarios Core Fundamentals [L1]
🎯 Target Role / Context: Kubernetes Scenario #88 (L1) · Advanced Scenarios

Q: What is the difference between `kubectl get` and `kubectl describe`?

get = brief summary table. describe = full detail including events. Use describe for debugging.

#Kubernetes #Advanced Scenarios #L1 #Container Orchestration #K8s
🎙️ Candidate Opening & Architectural Context
"<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."
Advertisement
⚡ Recommended Practice Lab

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.

1️⃣

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 yaml or -o json gives the full object including status, ownerReferences and metadata.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 json follows the API schema and is safe to script. describe text layout is not an API and can change between kubectl versions.
  • Scope: get works across many objects at once (-A, -l, --watch); describe is meant for one object or a small selected set.
2️⃣

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 wide adds node and IP columns without leaving table form.
  • Extract a field: -o jsonpath or -o custom-columns returns exactly the fields you need for a script or a quick audit.
  • Watch rollouts: -w streams changes, handy while a Deployment rolls out.
  • Full truth: -o yaml shows status.conditions and ownerReferences, which describe only partially renders.
Advertisement
3️⃣

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, BackOff or image pull errors.
  • Container state: shows Last State, exit code, reason (OOMKilled, Error) and restart count in one place.
  • Node view: describe node shows 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.
Pro Tip: If a pod is Pending, run <code>describe</code> first: the <code>FailedScheduling</code> event names the exact reason (insufficient CPU, untolerated taint, unbound PVC) that <code>get</code> never shows.
4️⃣

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 -A with a field selector isolates the unhealthy pods quickly.
  • Step 2: describe on one representative pod gives the reason from Events.
  • Step 3: get -o yaml confirms the effective spec (resources, probes, nodeSelector) the controller actually produced.
  • Step 4: logs --previous adds application-level evidence for crash loops.
5️⃣

Pitfalls and what to automate

Know where each command misleads you.

  • Do not parse describe: use -o json with jq or jsonpath in CI and runbooks.
  • Events expire: ship them to your logging stack so evidence survives the retention window.
  • Secrets: describe secret hides values but get secret -o yaml shows base64 data, so restrict RBAC on get.
  • Stale view: a table from get can lag a fast-changing object, so add -w or re-run.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Use kubectl get -o yaml (or jsonpath) as the source of truth and for scripts, and kubectl describe only to read Events when asking why a resource is unhealthy."
⚡ 60-Second Elevator Pitch Talking Points
  • 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.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. 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.
  2. 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.
  3. 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.
  4. Assuming describe shows the full spec It is a summary; fields like managedFields, full ownerReferences and some annotations only appear in get -o yaml.
Advertisement
📥 FREE DOWNLOAD · 101-PAGE COMPANION HANDBOOK
Studying for Kubernetes & SRE Technical Rounds?
Download the complete 100-question PDF field guide covering all 11 core modules with offline diagnostic runbooks.
📥 Download PDF (Free) Read Online Guide →
Want more Kubernetes scenarios?
Explore our complete collection of scenario-based Kubernetes interview runbooks.
Browse All Kubernetes Questions →