kubectl Get Nodes¶
Introduction¶
This guide explains kubectl get nodes with practical kubectl commands, realistic output, and production-focused checks. The examples focus on commands you can run during daily cluster administration and incident response.
When to Use This Command¶
Use it when you need to inspect, change, or verify Kubernetes resources without guessing. Prefer namespace-scoped commands unless you intentionally need cluster-wide output.
Basic Syntax¶
kubectl get nodes -o wide
Practical Examples¶
kubectl get nodes -o wide
kubectl describe node worker-1
kubectl get pods -A --field-selector=status.phase=Pending
kubectl describe pod pending-pod -n app
kubectl get events -n app --sort-by=.lastTimestamp
Example output:
NAME STATUS ROLES AGE VERSION
worker-1 Ready <none> 14d v1.30.2
Useful Options¶
- Use
-n <namespace>to avoid checking the wrong namespace. - Use
-o wide,-o yaml, or-o jsonwhen default columns are not enough. - Use label selectors for application-focused output.
Verification¶
kubectl get events -n app --sort-by=.lastTimestamp
kubectl get all -n app
Common Mistakes¶
- Running commands in the wrong context or namespace.
- Editing live resources without saving the manifest in version control.
- Ignoring events because the first kubectl output looks normal.
Production Tips¶
Check the current context before making changes, use dry-run where supported, and prefer declarative manifests for repeatable changes.
Related Guides¶
- kubectl Troubleshooting Cheat Sheet
- kubectl Logs Examples
- kubectl Describe Pod
- kubectl Events Troubleshooting
Summary¶
Good kubectl usage is precise: choose the right context, namespace, output format, and verification command before changing production workloads.