The Boring Infra ▍

KUBERNETES · COMMAND LINE

The first ten commands to run on a cluster you didn't build

18 November 2026 · 11 minute read

You are handed a kubeconfig and a question. Something in the cluster is wrong, or nothing is wrong yet and you're about to touch it. Ten commands answer where you're pointing, what the cluster thinks of itself, what is running, what is failing, and why. The captures below come from a throwaway cluster built for this article, so every number is real.

Run these in order. kubectl config current-context (which cluster), kubectl cluster-info (is it alive), kubectl get nodes -o wide (the machines), kubectl get ns (the namespaces), kubectl get pods -A -o wide (the workloads), kubectl get deploy -A (the intent), kubectl get events (recent history), kubectl describe pod (why it broke), kubectl logs (what it printed) and kubectl api-resources (object kinds).

Every number here is relative to my cluster and setup. Yours may have more CRDs, more namespaces, more pods, and the columns are the part that carries over.

1. Which cluster am I on

This is first because it's the mistake everyone makes once. A kubeconfig can hold a dozen contexts, and the one that's current is the one your next command will change.

$ kubectl config current-context
kind-tbi-demo

One line, and it's worth reading out loud before anything destructive. The companion command is kubectl config get-contexts, which lists all of them with a star on the current one, and kubectl config use-context switches. A platform engineer's kubeconfig holds a dozen contexts, most of them production, and they move between them all day. That's why this line earns its place at the top, because the command that lands on the wrong cluster is always one you were sure you were pointed at correctly.

2. Is the API even reachable

kubectl cluster-info asks the control plane to answer. When it responds you know the network path, the certificate and the endpoint are fine, which removes a whole category of suspicion before you look at workloads.

$ kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:37195
CoreDNS is running at https://127.0.0.1:37195/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

If this fails, nothing later in the list will work and the problem is between you and the API server rather than inside the cluster. That's a different troubleshooting path, and knowing which one you're on saves the most time of any step here.

3. What are the nodes

kubectl get nodes -o wide is the widest useful view of the machines. Status, roles, version, address, OS image, kernel and container runtime, one row each.

$ kubectl get nodes -o wide
NAME                     STATUS   ROLES           AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION      CONTAINER-RUNTIME
tbi-demo-control-plane   Ready    control-plane   94s   v1.31.0   172.20.0.2    <none>        Debian GNU/Linux 12 (bookworm)   6.1.0-28-amd64   containerd://1.7.18

A node that's NotReady explains every pod that suddenly stopped being scheduled, and a version column that disagrees between nodes tells you a rolling upgrade was interrupted. A node that says Ready can still be refusing work, and that's the second thing to read. kubectl describe node shows the conditions, and MemoryPressure or DiskPressure there explains a pod that stays Pending with no obvious reason. The Allocatable block answers why a pod that needs 4 CPU won't fit on a node with 3.8 left. The runtime column names the engine that actually pulls and runs images. You'll meet two. containerd is on EKS, GKE, AKS, k3s and anything built with kubeadm. cri-o is the default on OpenShift, appears on a few vendor platforms such as SUSE CaaS and Oracle Linux, and shows up anywhere someone installed it deliberately. Everything else you're likely to meet is containerd. Docker isn't in the list any more, because Kubernetes removed the dockershim in v1.24, so a node still running Docker Engine is either pre 1.24, where the shim still existed, or has the out of tree cri-dockerd adapter installed.

4. What namespaces exist

Namespaces are how the cluster separates work. Without this list you're guessing at names in every command that follows.

$ kubectl get ns
NAME                 STATUS   AGE
default              Active   94s
kube-node-lease      Active   94s
kube-public          Active   94s
kube-system          Active   94s
local-path-storage   Active   90s

The four that start with kube are the cluster's own, and local-path-storage is the storage provisioner this particular distribution installs. Anything else was created by whoever runs the cluster, and those names are usually the fastest clue about what the cluster is for.

5. What is running

kubectl get pods -A -o wide across every namespace, with node and pod IP, is the single most informative line of output in kubectl. READY shows containers ready over containers declared, and RESTARTS is the number that predicts an incident.

$ kubectl get pods -A -o wide
NAMESPACE            NAME                                            READY   STATUS             RESTARTS   AGE   IP            NODE                    NOMINATED NODE   READINESS GATES
demo                 broken                                          0/1     ImagePullBackOff   0          14s   10.244.0.8    tbi-demo-control-plane              
demo                 web-89fb66b57-wkk94                             1/1     Running            0          15s   10.244.0.7    tbi-demo-control-plane              
kube-system          coredns-6f6b679f8f-ftrxm                        1/1     Running            0          42s   10.244.0.3    tbi-demo-control-plane              
kube-system          coredns-6f6b679f8f-pd5qf                        1/1     Running            0          42s   10.244.0.4    tbi-demo-control-plane              
kube-system          etcd-tbi-demo-control-plane                      1/1     Running            0          49s   172.20.0.2    tbi-demo-control-plane              
kube-system          kindnet-mxkl2                                   1/1     Running            0          43s   172.20.0.2    tbi-demo-control-plane              
kube-system          kube-apiserver-tbi-demo-control-plane            1/1     Running            0          49s   172.20.0.2    tbi-demo-control-plane              
kube-system          kube-controller-manager-tbi-demo-control-plane   1/1     Running            0          49s   172.20.0.2    tbi-demo-control-plane              
kube-system          kube-proxy-fcwdg                                1/1     Running            0          43s   172.20.0.2    tbi-demo-control-plane              
kube-system          kube-scheduler-tbi-demo-control-plane            1/1     Running            0          49s   172.20.0.2    tbi-demo-control-plane              
local-path-storage   local-path-provisioner-57c5987fd4-4cg6w         1/1     Running            0          42s   10.244.0.2    tbi-demo-control-plane              

Read RESTARTS before anything else. A pod can read Running 1/1 with a restart count that keeps climbing, and that's the state where STATUS tells you nothing. A pod that isn't Running still appears in this list, and its reason is one command away, in step eight.

6. What should be running

Pods are the symptom and deployments are the intent. Comparing the two is how you find a rollout that never finished.

$ kubectl get deploy -A
NAMESPACE            NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
demo                 web                      1/1     1            1           13s
kube-system          coredns                  2/2     2            2           117s
local-path-storage   local-path-provisioner   1/1     1            1           115s

READY is ready over desired. AVAILABLE is its own count of pods that passed readiness, and the up to date column counts pods running the current spec, so a rollout in progress can leave READY at its old value while that one lags behind it. Read the three together and the shape of the rollout is obvious. That gap between what exists and what was asked for is the most common quiet failure in a cluster. The louder failure is one layer out. Pods can be healthy and traffic still dead, because a Service selects them by label and a readiness probe decides whether they're endpoints. kubectl get endpointslices shows who is actually behind the Service, and an empty list there with ten running pods is a selector or probe bug, not a pod problem.

7. What is happening right now

Events are the cluster narrating itself. Sorted by time, the newest line sits at the bottom, and on a failed image pull that's the BackOff you came to find.

$ kubectl get events -n demo --field-selector involvedObject.name=broken --sort-by=.lastTimestamp
LAST SEEN   TYPE      REASON      OBJECT       MESSAGE
14s         Normal    Scheduled   pod/broken   Successfully assigned demo/broken to tbi-demo-control-plane
13s         Warning   Failed      pod/broken   Failed to pull image "nginx:does-not-exist": rpc error: code = NotFound desc = ... not found
13s         Warning   Failed      pod/broken   Error: ErrImagePull
13s         Normal    BackOff     pod/broken   Back-off pulling image "nginx:does-not-exist"
13s         Warning   Failed      pod/broken   Error: ImagePullBackOff
1s          Normal    Pulling     pod/broken   Pulling image "nginx:does-not-exist"

That's a deliberately broken pod in the demo cluster, and the event stream names the cause in five lines. Events are kept for one hour by default, which is the --event-ttl setting on the API server, and they're purged in batches rather than on the stroke of the hour. Run this early in a conversation, not after an hour of digging. One wrinkle worth knowing. The sort keys off .lastTimestamp, and some events are written with it empty, so treat the order of two events from the same minute as approximate.

8. Why is this pod unhappy

kubectl describe pod prints the pod's spec, its container states and then an Events section, which is where the answer usually lives.

$ kubectl -n demo describe pod broken | tail -7
  Type     Reason     Age               From               Message
  ----     ------     ----              ----               -------
  Normal   Scheduled  14s               default-scheduler  Successfully assigned demo/broken to tbi-demo-control-plane
  Warning  Failed     13s               kubelet            Failed to pull image "nginx:does-not-exist": rpc error: code = NotFound desc = ... not found
  Warning  Failed     13s               kubelet            Error: ErrImagePull
  Normal   BackOff    13s               kubelet            Back-off pulling image "nginx:does-not-exist"
  Warning  Failed     13s               kubelet            Error: ImagePullBackOff

Read the tail first, because the reason is nearly always the newest event. A typo in an image tag, a missing image pull secret, a node out of disk and a failed readiness probe all look identical in the pod list and completely different here. When the pod is stuck at ContainerCreating, the same section often names the volume or the CNI plugin that's holding it.

9. What did it say

kubectl logs is the application's own account. Point it at a deployment to get one of its pods, and use the tail flag so a chatty service does not flood your terminal.

$ kubectl -n demo logs deploy/web --tail=4
2026/11/18 05:01:29 [notice] 1#1: start worker process 52
2026/11/18 05:01:29 [notice] 1#1: start worker process 53
2026/11/18 05:01:29 [notice] 1#1: start worker process 54
2026/11/18 05:01:29 [notice] 1#1: start worker process 55

Two things to know before you trust an empty answer. --previous reads the log of the last terminated attempt, which is often where a crashloop explains itself. It isn't a guarantee. A container that never started returns a not found error, and a container killed seconds ago can come back empty while the runtime catches up, so describe pod and the exit code are the other half of the answer. A pod that has been deleted took its logs with it, so the application's last words are gone unless the cluster also ships them somewhere durable.

10. What kinds of object exist here

kubectl api-resources lists every resource type the API server knows, which is how you learn whether a CRD is installed before you go looking for a YAML that won't apply.

$ kubectl api-resources | head -5
NAME                                SHORTNAMES   APIVERSION                        NAMESPACED   KIND
bindings                                         v1                                true         Binding
componentstatuses                   cs           v1                                false        ComponentStatus
configmaps                          cm           v1                                true         ConfigMap
endpoints                           ep           v1                                true         Endpoints

$ kubectl api-resources | wc -l
59

Fifty eight resources on Kubernetes 1.31, with the header making fifty nine lines, and events counted twice because it appears under both v1 and the events API group. The number is a characteristic of the install rather than a law, and it grows with every operator or extra component you add. When a manifest fails with "no matches for kind", this list is the proof of whether the CRD is missing or the API version is wrong.

Which one to use, at a glance

CommandAnswersReach for it when
config current-contextWhich cluster you're pointed atBefore anything destructive
cluster-infoWhether the API server answersEvery command is failing
get nodes -o wideNode health, version, runtimePods stop being scheduled
get nsNamespaces in the clusterYou don't know where to look
get pods -A -o wideEvery pod, restarts, nodeFirst look at workload health
get deploy -ADesired against available replicasPods look fine and traffic doesn't
get events --sort-byThe recent event streamSomething changed in the last hour
describe podOne pod's state and eventsA pod isn't Running
logs --tailThe application's own outputIt runs and misbehaves
api-resourcesObject kinds and API versionsA manifest won't apply

Verify it works

The first two commands decide whether the rest are worth running, and the third counts what's alive. This is what they return on this cluster.

$ kubectl config current-context; kubectl get nodes --no-headers | wc -l; kubectl get pods -A --no-headers | grep -c Running
kind-tbi-demo
1
10

One node, ten running pods, and a context name you recognise. If the context isn't the one you expected, stop here and switch before you read anything else.

The honest caveat

Every command in this list answers with whatever your credentials are allowed to see, and that's the caveat worth carrying. A role bound to one namespace doesn't return an empty cluster wide list, it returns a Forbidden error. The trap is that a team who only ever runs -n their-namespace never sees that error, so they read a quiet namespace as a quiet cluster. kubectl auth can-i --list answers what you may do here, and kubectl auth can-i list pods --all-namespaces answers the narrower question of whether one specific call should work. Both send a POST under the hood, so they're the two commands on this page that aren't strictly read only. Nothing changes, and it's worth knowing anyway.

kubectl top nodes is the one people reach for first and it's not in the ten, because it needs a metrics server that a fresh cluster doesn't have. Here is the honest answer on the cluster these captures came from.

$ kubectl top nodes
error: Metrics API not available

That error means the metrics pipeline is missing, not that the nodes are idle. Events expire, pods that are deleted take their logs, and a context you didn't check will happily run your command against the wrong cluster. Check the context, check what you're allowed to see, and treat an empty list as a question rather than an answer.

The boring conclusion

Ten commands, in this order, and you know which cluster you're on, whether it can answer at all, what its nodes look like, where the workloads live, what is failing and why. The reason a cluster feels opaque is almost never a missing tool. It's that the first command people run is the one furthest down this list.

Which one do you run first when someone says the cluster is broken?

Frequently asked questions

What are the first kubectl commands to run on a cluster?

Start with the context, then whether the API server answers, then the node list. After that, the namespaces, every pod with its restart count, the deployments, the recent events, describe on anything unhealthy, its logs, and the list of resource kinds.

How do I know which cluster kubectl is pointing at?

Run the config current context subcommand. It prints one name, the list form prints every context with a star on the current one, and switching is the same command with the other name. Read it before anything destructive.

Why does kubectl return an empty list?

Usually permissions. A role bound to one namespace returns a Forbidden error for a cluster wide request, and a team that only ever works inside its own namespace never sees that error, so the cluster reads as idle. The permission check kubectl offers prints exactly what your credentials may do.

Why does kubectl top nodes fail?

The metrics API isn't installed. kubectl top needs a metrics server, which a fresh cluster doesn't ship, so the error means the pipeline is missing rather than the nodes being idle.

How long do Kubernetes events last?

One hour by default, set by the API server's event TTL, and purged in batches rather than exactly on the hour. That's why the event stream is worth reading early in an incident, and why a problem from yesterday leaves nothing behind.

Where did my pod logs go?

A deleted pod takes its logs with it. Use kubectl logs --previous for a container that restarted, and ship logs to durable storage if you need them after the pod is gone.

Does Running mean healthy in kubectl get pods?

No. Running means the container started. A readiness probe can still be failing, the deployment can be short of its replicas, and the restart count can be climbing while STATUS reads Running.

Resources

The references these commands follow, so the flags behave here the way they behave against your cluster.

If the question turns out to be the node rather than the cluster, the next rung is the first ten commands on a linux machine, then lsblk, du and df for the disk underneath it.