Linux CLI Basics
This section covers the core Linux commands platform engineers use on Kubernetes worker nodes to debug the runtime and kernel below the pod.
Search across all documentation pages
This section covers the core Linux commands platform engineers use on Kubernetes worker nodes to debug the runtime and kernel below the pod.
Every example runs on the host, not inside a container, so you reach it via SSH, SSM, or kubectl debug node/<name>.
kubectl debug node/<name> for a privileged shell).crictl configured with the containerd socket; most distros ship it. If not:# One-time crictl config so you can drop the --runtime-endpoint flag
cat >/etc/crictl.yaml <<'EOF'
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
EOFsudo for nsenter, journalctl, and the cgroup filesystem.One line to see CPU, memory, and load pressure on the host.
top -b -n1 | head -20-b runs in batch mode so output is greppable and scriptable.-n1 takes a single snapshot instead of refreshing.Image pull failures and evictions frequently trace back to a full disk.
df -h /var/lib/containerd /var/lib/kubelet/var/lib/containerd holds image layers and container snapshots./var/lib/kubelet holds emptyDir volumes and ephemeral storage.DiskPressure.du -sh /var/lib/containerd/* | sort -h to find the culprit.Map a host PID back to the pod it belongs to.
ps -eo pid,ppid,cgroup,comm | grep -v '/system.slice' | headcgroup in the output reveals the kubepods slice, which encodes QoS class and pod UID.kubepods.slice; Burstable and BestEffort get nested sub-slices.grep <pod-uid> once you have the UID from kubectl.The kubelet and containerd log to the systemd journal, not to files.
journalctl -u kubelet -u containerd --since "10 min ago" --no-pager-u selects a systemd unit; you can pass several to interleave them by timestamp.--since scopes the window so you are not scrolling boot history.-p err to show only error priority and above.The kernel ring buffer records OOM kills, network driver resets, and filesystem errors.
dmesg -T | grep -i -E 'oom|killed|blocked' | tail-T prints human-readable timestamps instead of seconds since boot.oom-kill line names the killed process and its cgroup, confirming a memory limit hit.blocked for more than 120 seconds points to I/O stalls, often EBS or NFS latency.kubectl.crictl is the CRI-aware client that shows what containerd actually runs.
$ crictl ps -a
CONTAINER IMAGE STATE NAME ATTEMPT POD
7f3a1b2c9d0e nginx@sha256 Running web 0 web-7d9f
2b8c4d1a6f5e redis@sha256 Exited cache 4 api-55c8-a includes exited containers, which reveals crash loops.ATTEMPT column counts restarts at the runtime level.crictl logs <id> and crictl inspect <id>.docker ps, this reflects the real pod runtime on a node.Confirm whether a service is actually listening on the host or in a namespace.
ss -tlnp | head-t TCP, -l listening, -n numeric, -p shows the owning process.Get a shell inside a container that has no shell of its own.
PID=$(crictl inspect --output go-template \
--template '{{.info.pid}}' <container-id>)
nsenter -t "$PID" -n -p ip addrcrictl inspect yields the host PID of the container's main process.nsenter -t <pid> -n enters just the network namespace to inspect its interfaces.-p -m to enter the PID and mount namespaces for a fuller view.kubectl exec fails because the kubelet is unhealthy.See real-time memory usage and OOM events for a pod, straight from the kernel.
cd /sys/fs/cgroup/kubepods.slice/<pod-slice>
cat memory.current memory.max memory.eventsmemory.current is live usage in bytes; memory.max is the enforced limit.memory.events counts oom and oom_kill occurrences since the cgroup was created.oom_kill count proves the workload needs a higher limit or a leak fix.When a container hangs, see which syscall it is blocked on.
strace -f -p "$PID" -e trace=network,file 2>&1 | head-f follows child threads; -p attaches to the running PID from step 8.-e trace=network,file filters to the syscalls that matter for hangs.connect() or futex() tells you it is a network or lock issue.strace adds overhead, so keep the attach brief.Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026