When a Kubernetes incident hits, always start with the same reflex: qualify the level of the problem (cluster, node, pod or network), then work your way down methodically. This guide gives you a systematic approach in 4 levels, with the kubectl commands that fit each situation. You will be able to locate the cause of an incident in a few minutes instead of searching at random.
What you will learn
- Apply a 4-level triage method: cluster → node → pod → network
- Use the 4 basic diagnostic commands:
get,describe,logs,events - Use kubectl debug with ephemeral containers to inspect a running pod
- Diagnose Service problems: DNS, EndpointSlices, kube-proxy
Prerequisites
- A working Kubernetes cluster on 1.37, the version the course teaches
kubectlconfigured and connected to the cluster- Read access to nodes, pods, events, logs and services
- You have followed the guide Observe the health of a cluster
- Basic knowledge of Services and of DNS in Kubernetes
Why use a repeatable method?
Under pressure, the natural reflex is to go straight to the logs of the suspect Pod. That is often a waste of time: if the problem comes from the node (full disk, kubelet down) or from the network (misconfigured Service, broken DNS), those logs will show nothing useful.
A structured method lets you:
- Quickly rule out the levels that work
- Locate the responsible layer before digging
- Communicate the state of the diagnosis clearly to the team
- Repeat the same approach at every incident
Overview: the 4 diagnostic levels
| Level | Question to ask | Main commands |
|---|---|---|
| 1. Cluster | Is the cluster reachable and healthy? | kubectl cluster-info, kubectl get nodes |
| 2. Node | Is a node in trouble? | kubectl describe node, kubectl top nodes |
| 3. Pod | Why is this pod not working? | kubectl describe pod, kubectl logs, kubectl debug |
| 4. Network | Is the traffic reaching the right place? | kubectl get svc, kubectl get endpointslices, DNS check |
The rule: start at the top and work down. If level 1 is healthy, move to level 2. If level 2 is healthy, move to level 3, and so on down to the network.
Level 1: is the cluster reachable?
Before anything else, check that you can talk to the API server and that the nodes are operational.
Check access to the cluster
kubectl cluster-infoExpected result:
Kubernetes control plane is running at https://192.168.122.50:6443CoreDNS is running at https://192.168.122.50:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxyIf this command fails, the problem is upstream of Kubernetes: network,
kubeconfig, VPN, expired certificate. Check your ~/.kube/config file and
the network connectivity to the API server.
Check the state of the nodes
A single NotReady node is enough to explain Pending Pods or
unreachable applications. This check takes one command and one column to
read. If all nodes are Ready, you rule out a whole family of causes.
kubectl get nodes| Status | Meaning | Action |
|---|---|---|
All Ready | The cluster is generally reachable, but that does not rule out a control plane, kube-system or network problem. Keep triaging according to the symptom | Check kube-system and /readyz |
One NotReady node | Problem on that node → go to level 2 | Inspect the node |
One SchedulingDisabled node | Maintenance in progress (cordon) | Normal if planned |
| No response | API server unreachable | Check the control plane |
Check the control plane components
kubectl get pods -n kube-system -o wideCheck that etcd, kube-apiserver, kube-controller-manager and
kube-scheduler are Running with RESTARTS at 0 (or very low).
For a finer diagnosis:
kubectl get --raw='/readyz?verbose' | grep -E '\[(\+|\-)\]'Each [+] line confirms a working subsystem. A [-] line flags a failing
component.
A kubectl that answers proves only one thing: the API server is
reachable and your kubeconfig is valid. All the nodes can be
NotReady, the scheduler can be stopped and the applications dead, and the
command will still answer. That is why level 1 does not stop there.
Level 2: inspect a node in trouble
If a node is unexpectedly NotReady or SchedulingDisabled, inspect it in
detail.
Read the node conditions
kubectl describe node <node-name>The Conditions section reveals the cause. These are the warning signs:
| Condition | Abnormal value | Likely cause |
|---|---|---|
Ready | False or Unknown | Kubelet stopped, network cut, node overloaded |
MemoryPressure | True | Not enough memory, pods too greedy |
DiskPressure | True | Full disk (nodefs, imagefs or inodes) |
PIDPressure | True | Too many processes on the node |
NetworkUnavailable | True | CNI plugin not working |
Check the node's resource consumption
kubectl top nodesIf a node shows CPU or memory close to 100%, pods may be getting evicted or may be unable to start.
Check the node's recent events
kubectl events --for node/<node-name> --types=WarningWarning events on a node can reveal disk, kubelet or network problems that the conditions do not show yet.
Level 3: diagnose a pod
Triage starts by identifying the state of the pod, then you pick the command that matches the symptom.
Identify the state of the pod
kubectl get pods -n <namespace> -o wide| Observed status | Meaning | Next action |
|---|---|---|
Pending | The pod is not scheduled yet or not ready to start yet | kubectl describe pod → look at Events (scheduling) |
ContainerCreating | The container is being created | Wait, then kubectl describe pod if it persists |
Running | At least one container is running | Check whether the application really answers |
CrashLoopBackOff | A container fails then restarts in a loop | kubectl logs --previous, kubectl describe pod |
ImagePullBackOff | The image cannot be downloaded | kubectl describe pod → Events (pull errors) |
Error | A container stopped with an error | kubectl logs --previous, kubectl describe pod |
OOMKilled does not appear in this table because it is not a pod status
in the same sense as Pending or Running. It is a container termination
reason, visible in kubectl describe pod under Last State. If you see
frequent restarts with OOMKilled, increase limits.memory.
The 4 basic diagnostic commands
Four commands are enough to start a diagnosis: kubectl get, describe,
logs and events. You have just used get; the following steps detail the
other three, then kubectl exec, which serves for interactive inspection of
the container, like kubectl debug further down.
-
kubectl describe pod, the full viewTerminal window kubectl describe pod <pod> -n <namespace>Sections to read first:
- Events: messages from the scheduler, the kubelet, the probes
- Last State: reason for the previous stop (OOMKilled, Error, etc.)
- Exit Code: a clue about the nature of the crash
- Containers → Env / Mounts: container configuration
- Conditions:
PodScheduled,Initialized,ContainersReady,Ready
-
kubectl logs, the application logsTerminal window # Logs of the current containerkubectl logs <pod> -n <namespace># Logs of the previous run (the one that crashed)kubectl logs <pod> -n <namespace> --previous# Multi-container pod: specify the containerkubectl logs <pod> -n <namespace> -c <container> --previous# Only the last 50 lineskubectl logs <pod> -n <namespace> --tail=50Look for:
Exception,Error,panic,Traceback,connection refused,permission denied,OOM. -
kubectl events, the filtered eventsTerminal window # Events of a specific podkubectl events --for pod/<pod> -n <namespace># Warning events of the namespacekubectl events -n <namespace> --types=WarningEvents complement the logs by showing what Kubernetes did (scheduling, image pull, kill by a probe, eviction).
-
kubectl exec, get inside the containerTerminal window kubectl exec -it <pod> -n <namespace> -- /bin/shFrom inside the container, you check four things that no outside command shows:
- Network connectivity:
wget,curl,nslookup - The presence of the expected configuration files
- The environment variables actually injected:
env - The running processes:
ps aux
If the container has no shell (distroless image), use
kubectl debug(see below). - Network connectivity:
Use kubectl debug (ephemeral containers)
Since Kubernetes v1.25, ephemeral containers are stable. They let you inspect a pod without changing its manifest, even if the image is minimal (distroless, scratch).
kubectl debug -it <pod> -n <namespace> --image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec --target=<container>This command starts a busybox container attached to the existing Pod. It
joins the Pod and shares at least its network context; access to the
process space depends on the mode used, on --target and on the
actual support of the runtime.
Available profiles with --profile:
| Profile | What it allows | Use case |
|---|---|---|
general | Isolated container in the pod | Basic network diagnosis |
baseline | Like general, more constrained | Restrictive environments |
restricted | Very limited | Clusters with a strict policy |
netadmin | Adds the NET_ADMIN and NET_RAW capabilities | Advanced network diagnosis (tcpdump) |
sysadmin | Full access (root, hostPID) | Deep system diagnosis |
# Advanced network diagnosis with tcpdumpkubectl debug -it <pod> -n <namespace> \ --image=nicolaka/netshoot:v0.16@sha256:b09d9b21381f47a79b3cbcb30da25266dc17186ea00ae65e99fdc51396f48e70 --profile=netadmin --target=<container>
# Diagnose a node directlykubectl debug node/<node-name> -it --image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ecLevel 4: diagnose the network (Services and DNS)
If the pod is running (Running) but the application is not reachable, the
problem is often at the level of the Service, the DNS or the Network
Policies.
Check the Service
kubectl get svc <service> -n <namespace>Check that the TYPE, the CLUSTER-IP and the PORT match what you expect.
Check the EndpointSlices
kubectl get endpointslices -n <namespace> -l kubernetes.io/service-name=<service>If the list of endpoints is empty, the Service finds no matching pod. Possible causes:
- The Service selector (
spec.selector) does not match the pod labels - The pods are not Ready (failed probe)
- The pods are in another namespace
Check DNS resolution
From a test pod:
kubectl run dnstest --image=busybox:1.37@sha256:a7dbc319b1438115a207e11930dc4bb3e643dcb3ec0bdd694bb36cd8fad289ec --rm -it --restart=Never -- \ nslookup <service>.<namespace>.svc.cluster.localExpected result: the name resolves to the Service IP (CLUSTER-IP).
If resolution fails:
# Check that CoreDNS is workingkubectl get pods -n kube-system -l k8s-app=kube-dns
# Check the CoreDNS logskubectl logs -n kube-system -l k8s-app=kube-dns --tail=20Test end-to-end connectivity
kubectl run curltest --image=curlimages/curl:8.21.0@sha256:7c12af72ceb38b7432ab85e1a265cff6ae58e06f95539d539b654f2cfa64bb13 --rm -it --restart=Never -- \ curl -v http://<service>.<namespace>.svc.cluster.local:<port>/If DNS works but the connection fails, check:
- The target port (
targetPort) in the Service definition - The Network Policies that might block the traffic
- kube-proxy (iptables/IPVS mode) on the nodes
The last suspect is the most discreet: Network Policies block
traffic without any error message, on the sender side as well as on the
receiver side. A connection that times out for no apparent reason in a
namespace that has some deserves a kubectl get networkpolicies -n <namespace>,
followed by a read of the ingress and egress rules.
Quick decision tree
Use this tree when you face a symptom and do not know which level to start with. It asks the questions in the order of the method, from the cluster to the network: a symptom at a higher level is handled before looking lower.
Each question has its "yes" exit on the same line, with the level concerned and the first command to run; only a "no" takes you down. The last exit, in grey, covers the symptom that no question recognizes: you start over at level 1 rather than guess.
The table gives the same mapping as a list of symptoms, handy for finding a row at a glance:
| Symptom | Probable level | First command |
|---|---|---|
kubectl does not answer | 1, Cluster | Check kubeconfig, network, VPN |
NotReady node | 2, Node | kubectl describe node <node> |
Pending pod | 3, Pod | kubectl describe pod <pod> (Events) |
CrashLoopBackOff pod | 3, Pod | kubectl logs <pod> --previous |
ImagePullBackOff pod | 3, Pod | kubectl describe pod <pod> (Events) |
Running pod but application unreachable | 4, Network | kubectl get svc, kubectl get endpointslices |
| Intermittent timeout | 4, Network | DNS check + Network Policies |
| Pods evicted for no apparent reason | 2, Node | kubectl describe node (conditions, pressure) |
Quick troubleshooting
This table does not replace the four levels: it is for when you recognize the symptom and want to go straight to the right place. When in doubt, start over at level 1: a cause searched for at the wrong level wastes more time than one extra step.
| Symptom | Probable cause | Solution |
|---|---|---|
kubectl timeout | API server unreachable | Check kubeconfig and network connectivity |
Persistent NotReady node | Kubelet stopped or full disk | SSH to the node, systemctl status kubelet |
Pending pod for a long time | No node with enough resources | kubectl describe pod → Events → adjust requests or add a node |
| Empty logs + exit code 137 | OOMKill (visible in Last State of describe) | kubectl describe pod → increase limits.memory |
| Empty logs + exit code 127 | Binary not found in the image | Check command: and the image tag |
Running pod but connection refused | Misconfigured Service or pod not Ready | Check the Service selector and the probes |
| DNS does not resolve | CoreDNS down | kubectl get pods -n kube-system -l k8s-app=kube-dns |
| Traffic blocked without error | Restrictive Network Policy | kubectl get networkpolicies -n <namespace> |
Key takeaways
- Always start at the top: cluster → node → pod → network. This avoids wasting time reading logs when the problem is a failed node
- The 4 basic commands are
kubectl get,describe,logsandevents.kubectl execandkubectl debugthen complete them for interactive inspection kubectl logs --previousis often forgotten: it shows the logs of the run that crashed, not the current onekubectl debugwith ephemeral containers lets you inspect a pod without restarting it, even on a distroless image- Network problems are often configuration problems: wrong Service selector, failing probe, blocking Network Policy
- Document your diagnosis: write down the commands you ran and their results, it helps to communicate with the team and to build runbooks
Knowledge check
Seven questions on the discipline of the method: what a command that
answers really proves, what an empty EndpointSlice means, and why a
NetworkPolicy never announces itself.
Knowledge check
Check what you have learned with this interactive quiz
How it works
- The timer starts when you click Start
- Multiple choice, true/false and short answer questions
- You can move between questions
- Detailed results are shown at the end
Starts the quiz and the timer
Review
(0/0)Result saved on this device. It will be sent to your account at the next sync. Sync now
Score by domain
A domain groups several guides and gets several questions, so its score is more reliable than a per-topic score, which often rests on a single question.
Summary
Strengths
No topic passed at 80% on at least two questions yet.
Weak areas
No topic below the pass mark.
Recommended next
Hints before you try again?
Continue the course: Analyze Kubernetes events with kubectl events
A new full quiz with random questions
Work again only on the questions you missed