⌨️ kubectl Commands Cheat Sheet
kubectl Commands Cheat Sheet: kubectl is the remote control for your cluster — you type a command, and it's the API Server, not kubectl itself, that actually executes it.
kubectl is the remote control for your cluster — you type a command, and it's the API Server, not kubectl itself, that actually executes it. Every single kubectl command, no exceptions, goes through the API Server. So why funnel even read-only commands like `kubectl get pods` through the API Server instead of letting kubectl talk to nodes directly? Because the API Server is the cluster's single source of truth and single security checkpoint — if kubectl could bypass it, every client would need its own authentication, authorization, and audit logic duplicated, the same risk a Java team takes when a service talks directly to another service's database instead of going through its API. This centralization is exactly why `kubectl logs ` from your laptop can show you what's happening on a node thousands of miles away in a cloud datacenter, and why a leaked kubeconfig file is as dangerous as a leaked root password — it IS the key to that single checkpoint.
GET commands — Inspect cluster state
kubectl get: Every Flag Reshapes the Same Snapshot
`kubectl get pods` only reads a snapshot of current state from etcd — it is a purely read-only query.
-o wide adds columns
No SECOND command is needed to add IP and node info to the same query — only the output format changes.
-A removes the namespace filter
Without `-A`/`--all-namespaces`, kubectl SILENTLY shows only the current namespace — another source of the "missing pod" confusion.
-w turns a snapshot into a live stream
`-w` keeps the connection OPEN — a new line prints every time state changes, the command never terminates.
-o yaml returns manifest format
This output is the FULL object definition — if saved to a file, it would be accepted as a valid manifest AS-IS.
Inspecting Resources
DESCRIBE — Detailed information + events